lua-users home
lua-l archive

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



Hi!
In some C source interfacing with Lua I found lots of:

lua_checkstack(L, nb);

with no return value check. Is it of any use or can I either
- remove them?
- use luaL_checkstack(L, nb, "out of memory"); instead?

What would you recommend? Is it really necessary to check the stack each time you push something to it or will the VM raise the "out of memory" error anyway?

Thank you!
Aladdin

int lua_checkstack (lua_State *L, int extra);
Ensures that there are at least extra free stack slots in the stack. It returns false if it cannot grow the stack to that size. This function never shrinks the stack; if the stack is already larger than the new size, it is left unchanged.

void luaL_checkstack (lua_State *L, int sz, const char *msg);
Grows the stack size to top + sz elements, raising an error if the stack cannot grow to that size. msg is an additional text to go into the error message.

_________________________________________________________________
Téléphonez gratuitement à tous vos proches avec Windows Live Messenger  !  Téléchargez-le maintenant ! 
http://www.windowslive.fr/messenger/1.asp