[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: multiple calls from Lua to C and C to Lua
- From: Javier Guerra <javier@...>
- Date: Mon, 21 Dec 2009 14:34:35 -0500
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