lua-users home
lua-l archive

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

> My main issue is that when passing a table as a parameter
> it is a huge pain to use getfield and then clean everything 
> up before pushing your return value(s) and returning.  
> Normally function parameters are always available on the 
> stack and you don't have to pop them before returning.  
> The table is available on the stack but you can't use
> it without putting more stuff on the stack that will need to 
> be cleaned up later.

The results of a function call are the (n) items at the top of the stack.    Lua should save and restore the state of the stack, including moving the results to the proper position on the stack (in luaD_poscall).  So, I don't believe you need to clean everything before pushing your returns, although that might be considered good form.

No banners. No pop-ups. No kidding.
Make My Way  your home on the Web -