lua-users home
lua-l archive

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


On 12/01/2010 11:50, sean farrow wrote:
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?

local value = AtcActions[key]
:)

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

_G[value]()

_G is the table of global identifiers, and by default functions are global entities.

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --