|
On Tue, Mar 8, 2011 at 9:02 PM, Chris Gagnon <cgagnon@zindagigames.com> wrote:Looking up the environment of the caller is not really the hack you
> There are many environment tables (a sandbox for each script, which may have
> many functions) and one globally registered utility function in c.
> In the globally registered utility function i need the environment to get at
> the ID.
> I don't have any data to look up the environment with.
think it is. It's a perfectly legitimate solution.
If you insist on not using it though, you can try to associate the
environment with the thread of the sandbox (each sandbox is in its own
coroutine). This would look nicer because to look up the ID would
simply require doing:
lua_getglobal(L, "ID"); /* looks up in the thread environment table */
--
- Patrick Donnelly