lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi:

I have the following lua table:

AtcActions =

{

[0] = "AtcDoNothing",

[1] = "AtcSayCharacter",

[2] = "AtcSayWord",

[3]="ActSayLine",

[4]="AtcLowSignal",

[5]="AtcHighSignal",

[6]="AtcSayLineGoNextLine",

[7]="AtcReadAloud",

[8]="AtcSayAttributes",

[9]="AtcSayAttributeChanges",

[10]="AtcRouteCursor",

[11]="AtcShowNextLine",

[12]="AtcShowPrevLine",

[13]="AtcLineEndSignal"}

The keys are numbers, the values in this case are the names of functions I wish to call.

Now if I know the value of the number of the function in the table I wish to call (x) how can I call this without iterating through the table—essentially is there a way of finding a value in a table given it’s key?

Once I have the value as a string, how do I invoke the function in the same script file with the values name?

Any help appreciated.

Cheers

Sean.