[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Q: Behaviour of the Lua stack
 
- From: Luiz Henrique de Figueiredo <lhf@...>
 
- Date: Fri, 13 Apr 2012 14:37:11 -0300
 
> This C function receives 10 arguments in the Lua stack.
Oops, bad API right there...
> 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;
> }
Yes, but if you don't want the user to handle the error, then
luaL_argerror makes it easier. See algo luaL_check*.