[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: loadstring to create a function with parameters
- From: Javier Guerra <javier@...>
- Date: Sun, 17 Dec 2006 09:10:08 -0500
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