lua-users home
lua-l archive

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


Seems to fix the issue (using local vars first, then using the locals as parameters) :)
Thanks.

Oh, and what about lua_pop? Do I need to use that in every function which uses the lua state?


> Date: Sun, 30 May 2010 22:41:54 +1200
> Subject: Re: Lua and C++ (stack)
> From: jmckaskill@gmail.com
> To: lua@bazar2.conectiva.com.br
>
> I presume getNpc is getting a userdata pointer out of a registry
> entry? In which case it will be pushing a value onto the stack. IIRC
> the compiler is free to reorder the calls to lua_getinteger and getNpc
> since they are non dependent and occur between the same sequence
> points. I would try calling lua_getinteger before and caching the
> values in a local variables.
>
> James


Voeg eenvoudig je Hyves vrienden toe aan je Hotmail en Messenger.