lua-users home
lua-l archive

Re: Q: Behaviour of the Lua stack

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


> 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*.

AltStyle によって変換されたページ (->オリジナル) /