[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: storing table and function references for later use
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Sun, 19 Aug 2007 19:35:19 -0400
Matthew Armstrong wrote:
> I don't see lua_push/is/get functions for table or function
> references. The only way I can think of storing them is with the
> registry, but that seems like a lot of work. Is there another way
> I'm missing?
There is a lua_istable and lua_isfunction. Lua tables are in fact hash
maps, and Lua function are in fact closures. There is no such kind of
obejcts in C, so it cannot be extracted to Lua. If you want to keep a
reference to them you have to put them in a table, like the registry,
the globals, a metatable or an environment table of one of your
userdata.