lua-users home
lua-l archive

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


On Tue, Apr 02, 2002 at 07:14:35AM -0300, Luiz Henrique de Figueiredo wrote:
> >How do I retreive a persistent reference to the second, the function?
> 
> Do you really need a persistent form? I mean, to store in a file and load
> later? If so, you can try ldumplib.c, available in the work version.
> 
> If you only need a reference that lives during the lifetime of your program,
> then you can use references (there's an API for it: lua_ref, lua_getref,
> lua_unref).

Also, if the weak refs aren't good enough, you can always create a table to
stuff temp functions into. that's what I tend to do if I need to accept a
function on one call, and then use it later.

Of course, you can only use it when Lua would let you anyway, but then
again, you'd expect that, right?

-- 
Daniel Silverstone                               http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler          Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org               KeyId: 20687895
You have the power to influence all with whom you come in contact.

Attachment: pgpnRA9ZLdNxM.pgp
Description: PGP signature