[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Getting the callers environment in c
- From: Drake Wilson <drake@...>
- Date: Mon, 7 Mar 2011 19:59:07 -0700
Quoth Chris Gagnon <cgagnon@zindagigames.com>, on 2011-03-07 17:32:30 -0800:
> All my lua runs in environments that contain an ID.
>
> here is the c:
> int SomeFuncImplementation(lua_State * L)
> {
> // I need the ID
> // How do i get it!?
>
> // This doesn't work because it's the environment of this c function
> which is useless to me
> lua_getfield(L, "ID", LUA_ENVIRONINDEX);
>
> // lua_getfenv() is useless cause i can't get the calling function on the
> stack to use this
> }
Where is this ID exactly? Could you describe the relation between the
environments in question (by which I assume you mean environment
tables associated with functions) and the call stack you're looking
at? In particular, is there a reason you can't pass the ID down as an
ordinary parameter?
> - Chris
---> Drake Wilson