lua-users home
lua-l archive

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


> That criteria appears to not be sufficient, e.g. `lua_error` doesn't
> push elements according to the manual, but `luaG_errormsg` uses
> `EXTRA_STACK` space. And some `luaL_` functions might use functions
> that push internally (e.g. `luaL_len` or `luaL_ref`).

Sorry, I thought you were talking about LUA_MINSTACK, because there
is no EXTRA_STACK in the API. EXTRA_STACK is an implementation detail
that should not concern API users. As I said, if the function does
not push something (according to its documentation), it should not
need stack slots. The fact that luaG_errormsg uses EXTRA_STACK is
completely irrelevant here (*). In Lua, we respect the manual. (If the
implementation says otherwise, it is a bug to be fixed.)

(*) Going down to the implementation, EXTRA_STACK serves exactly to
allow those internal pushes even when apparently there are no more
slots available.

-- Roberto