lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Rici Lake
> Sent: Saturday, September 18, 2004 1:22 AM
> To: Lua list
> Subject: Re: Stack level doesn't match hook events
> 

> This is a tail call; it is effectively optimised into a jump.
> So the caller of the_page_stack:restore_device_objects() has 
> been removed from the stack before the function is called.

 To wrap this thread up.  What seemed like the right thing to do, count
LUA_HOOKCALLs to keep track of the stack depth, is a bad idea.  First
because LUA_HOOKCALL changes meaning when it's a tail call as the stack
depth doesn't change (how about a LUA_HOOKTAILCALL?).  Second depending on
the complexity of your script the hooks add up.  Our 2d game which is almost
completely Lua script went from ~20fps while the debugger is connected to
over 200fps when I removed the call/return events from the hook.

  Tom Spilman
  Co-owner | Programmer
  www.sickheadgames.com