[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Q: Behaviour of the Lua stack
- From: Antonio Vieiro <antonio@...>
- Date: Fri, 13 Apr 2012 18:53:29 +0200
Hi all,
I have a question that I'd like more experience users to answer.
Imagine I'm writing a C function to be called from Lua.
This C function receives 10 arguments in the Lua stack.
If I detect an error on, say, the first argument, may I do this?
if (error on the first argument) {
lua_pushnil(L);
lua_pushstring(L, "Error on first argument");
return 2;
}
So that I return 2 arguments : nil and an error string?
If so, what happens with the other 10 elements in the stack? Does Lua
clean the up automatically or am I supposed to clean all the arguments
before pushing my return values in the stack?
Thanks,
Antonio