lua-users home
lua-l archive

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


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