lua-users home
lua-l archive

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


On Wed, 16 Sep 2009, David Manura wrote:
>
> This is not possible to do correctly because the wrapper increases the
> stack level.  Maybe some special "call" function (in the form of
> pcall) could be implemented to call a given function within the
> current stack level.

That isn't possible. You have to increase the stack level to save the
nested return addresses. If the wrapper can do everything it needs before
calling the wrapped function, then you can do a tail call so you don't
need to save an extra return address and the stack level can remain the
same.

Tony.
-- 
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
GERMAN BIGHT HUMBER: SOUTHWEST 5 TO 7. MODERATE OR ROUGH. SQUALLY SHOWERS.
MODERATE OR GOOD.