lua-users home
lua-l archive

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


From my understanding, lua_error() does a longjump. How nicely (if at all) does this play with C++'s unwinding? For example:

int check(lua_State* L)
{
   StateMaintainer sm(GetGlobalState());

   sm.ModifyState(State::FunkyModification);

   if (lua_gettop(L) != 2)
   {
      lua_pushstring (L, "Wrong number of args!");
      lua_error(L);
   }

   // something

   return 0;
}

At the end of this function, C++ will call StateMaintainer's destructor on sm. But if there's an error, and lua_error() is called, then, is it called at all? Or is it silently ignored?

--
// David Morris-Oliveros
// Camera Coder
// Team Bondi


------------------------------------------------------------------------
Contact:
Team Bondi Pty Ltd
Level 2, 608 Harris Street
Ultimo, NSW 2007
Australia
Tel: +61 (0)2 8218 1500
Fax: +61 (0)2 8218 1507
Web: http://www.teambondi.com
------------------------------------------------------------------------
This email may contain confidential information.  If you are not
the intended recipient, you may not copy or deliver this message to
anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Opinions, conclusions and other
information in this message that do not relate to the official business
of our firm shall be understood as neither given nor endorsed by it.
------------------------------------------------------------------------