[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Getting the callers environment in c
- From: Chris Gagnon <cgagnon@...>
- Date: Mon, 7 Mar 2011 17:32:30 -0800
Lets say i have some lua that calls SomeFunc() which I've mapped to SomeFuncImplementation()
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
It's seems like this should be easy, what am i missing?