lua-users home
lua-l archive

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


Thanks Javier.

I dont use coroutines and as far as I know I dont get any Lua_State pointer explicitly. Is it hidden somewhere in the stack?

Danilo

2009/12/21 Javier Guerra <javier@guerrag.com>
On Mon, Dec 21, 2009 at 2:26 PM, zweifel <zweifel@gmail.com> wrote:
> I am considering this to be related with the stack of lua, and since I am
> always using the same lua state it could be messing around with the previous
> lua stack of parameters. Or shouldn't it be happening?

in your C function called by Lua, you get a Lua_State pointer.  be
sure to use this pointer only, and only during the duration of your
call.

In the simple cases, the pointer Lua passes you is the same you
created initially from C; but if you use coroutines anywhere, it could
be a new state, with it's own stack and local frame; but the same
global state, so you must not call an unexpected state.  (at least not
without deep understanding of the way they're all intertwined)

--
Javier