[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: report on the Lua in the Gaming Industry Roundtable at GDC 2004
- From: Dario Accornero <adario@...>
- Date: Fri, 16 Apr 2004 19:32:04 +0200
On 16 Apr 2004, at 17:15, Mark Hamburg wrote:
on 4/16/04 6:22 AM, Edgar Toernig at firstname.lastname@example.org wrote:
The C<->Lua transition is normally cheap. Not very different from a
function call within Lua. But what *could* be expensive is lua_pcall.
The problem with lua_pcall is that it uses setjmp/longjmp which
performs a system call on some systems (those which preserve signal
masks). You could either try _setjmp/_longjmp instead or use lua_call
and catch errors elsewhere (may become difficult with C++).
Additionally, lua_call instead of lua_pcall would remove stack frames
5, 6, and 7 from the above trace.
You could also revise luaD_rawrunprotected and luaD_throw to use C++
exceptions. (Covered previously on this list.) Then Lunar wouldn't
use pcall to catch any errors since they would be reported just like
P.S. lua_lock and lua_unlock for multithreaded execution become a
issue in Lua/C and C/Lua transitions.
Thanks to both of you for your suggestions, which I'll both try out --
currently Lua is always run from a single thread in my application, so
I leave lua_lock/unlock empty by default.