lua-users home
lua-l archive

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


> I thought about reserving stack slots (using `lua_settop`) in front
> of the arguments/results of `lua_pcall` and then shifting the
> results so that there are free stack slots available at the top.
> However, if I can't even call Lua API functions (`lua_remove` or
> `lua_copy`) in a save way after the `lua_pcall`, that won't work.
> 
> Are there any functions that are guaranteed to work without any
> available stack slots (e.g. `lua_settop` and `lua_pop` should work,
> as well as `lua_checkstack`)?

All API functions that do not push stuff (as flagged in its documentaion)
should work without any available stack slots.  That includes both
lua_remove and lua_copy (and lua_rotate, which seems your best option
for moving the results).

-- Roberto