Using an Array to Store Function Names for Use Later

I am writing my quest .as files for my RPG that I am making. At the present moment I am having issues with certain commands and how best to accomplish them. This pertains to my conversation system that I have in place. Currently, the conversations are stored as an array, with each index in the array representing a different “page” of the conversation. Now for my quests, at the end of each conversation (the last index in the array), I want a certain function to occur (receiving the quest, updating the quest, completing the quest). So my thought is to have a separate array with the same number of elements as the conversation array, and when the conversation text is updated to reflect the next page, it also will access the function array with that given index, and therefore only on the last page of the conversation will the function be executed.
However my question is this, if I have code set out like such:



[LEFT][COLOR=#993300]var[/COLOR] a:[COLOR=#993300]Array[/COLOR] = [COLOR=#000000][[/COLOR]func0, func1, func2[COLOR=#000000]][/COLOR];

[COLOR=#993300]function[/COLOR] func0[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR][COLOR=#000000]{[/COLOR]
  [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]0[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] func1[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR][COLOR=#000000]{[/COLOR]
  [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]function[/COLOR] func2[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR]:[COLOR=#993300]void[/COLOR][COLOR=#000000]{[/COLOR]
  [COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]2[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#993300]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#993300]var[/COLOR] i:[COLOR=#993300]int[/COLOR] = [COLOR=#000000]0[/COLOR], ilen = a.[COLOR=#993300]length[/COLOR];i<ilen;i++[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
   a[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#000000][/COLOR]

[/LEFT]

Now my question is this, when is the code actually executed? When it is placed within the array, or when it is accessed with the for statement?