lua-users home
lua-l archive

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


On Sunday 17 December 2006 8:18 am, Terisquas Brothers wrote:
> Is there any way to convert the string funcName to a
> function which accepts a single parameter?

a global function is just an anonymous function stored as a named field in the 
environment variable, usually _G

therefore:

funcXY()

is the same as:

_G["funcXY"] ()

in fact, i guess both compile to the same bytecode. (maybe using a constant 
reference for the environment, instead of _G)

so, even if you have reloaded some code, executing the first form should fetch 
the 'new' global function from the environment

-- 
Javier

Attachment: pgp8gZtVqjMIn.pgp
Description: PGP signature