Ronald Lamprecht wrote: > Hi, > > Daniel Heck wrote: >>> 2. switch Lua to C++ for Linux and other OS, too >>> >>> As approach 1. means a lot of work and would force a rewrite of all >>> tolua based code I would prefer the second solution. >>> >>> Is anyone aware of other solutions? Does anyone object solution 2? >> >> I think this would be a reasonable solution for the moment, although I'm >> not sure that this is safe from Lua's perspective. For example, I'm not >> sure that this couldn't lead to memory leaks in the Lua interpreter, or >> leave the Lua interpreter in some inconstistent state. > > As we release the Lua interpreter as part of the level abortion we > should not run into trouble. You can test the fix by configuring the > current revision with option "--enable-cxxlua".
Ah, I see. I also hadn't noticed that Lua is configured to use C++ exception handling instead of the usual longjmp when it is compiled as C++. >> It doesn't solve another problem: Lua scripts still don't have a chance >> to handle errors raised in the Enigma engine. A better (long-term) >> solution might therefore be to map C++ exceptions to "lua_error" or >> luaL_error calls. I don't think that this is an urgent issue at the >> moment, and I'm not sure that tolua would support this, but it's >> certainly something to think about. > > Does any Lua support exist for catching Lua-error calls from within Lua > code? Yes, you can use pcall() to do this. "Programming in Lua" has a very good description of this topic (and most others). - Daniel _______________________________________________ Enigma-devel mailing list Enigma-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/enigma-devel