Re: Q: Behaviour of the Lua stack
[
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: 2012年4月13日 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*.