[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Trouble running Lua script from C++ application
- From: Cooper Clauson <ceclauson@...>
- Date: Thu, 26 Jun 2008 11:59:39 -0700
Thanks so much, that fixed the problem!
I have no idea why the compiler didn't check that. I'm submitting a bug report about it.
Thanks again!
-Cooper
----------------------------------------
> Date: Thu, 26 Jun 2008 16:42:43 +0100
> From: dg@cowlark.com
> To: lua@bazar2.conectiva.com.br
> Subject: Re: Trouble running Lua script from C++ application
>
> Robert Raschke wrote:
> [...]
>>> lua_pop(L, 3);
>>> }
>>
>> I think you need to return the number of results you are leaving on
>> the stack. So, try replacing your pop with a return 0. Not sure what
>> happens if you return nothing at all.
>
> Hopefully, the compiler should scream...
>
> What you get is an undefined result. In practical terms, you normally
> find it returns the result of the last function called, which in this
> case would be lua_pop() --- but since that returns void, you'll get
> something random produced by the implementation of lua_pop().
>
> Note that typically you needn't bother cleaning up the Lua stack when
> returning from a C function like this; the VM will do it for you.
>
> --
> David Given
> dg@cowlark.com
>
_________________________________________________________________
Need to know now? Get instant answers with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008