[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT, x86, C++ without exceptions, and errors
- From: Mike Pall <mikelu-1102@...>
- Date: Tue, 15 Feb 2011 15:53:53 +0100
Christian Tellefsen wrote:
> I see that it says in the LuaJIT docs that "Lua errors cannot be
> caught on the C++ side". Does this mean that there is no way to
> detect an error in a Lua script, report it, and then continue
> execution afterwards, when using LuaJIT on this platform?
The text you mention deals with the interaction between C++
exceptions vs. Lua error handling.
So the above sentence just means you cannot use C++ try/catch to
catch a lua_error(). But since you disabled exception handling,
you won't be able to use try/catch, anyway.
But of course you can use lua_pcall() or pcall() to catch a
lua_error() or error() on all platforms.
> Also, I get a crash when doing this a second time:
>
> lua_State * L = lua_open();
> luaL_openlibs(L);
>
> Is this an incorrect way of creating 2 completely separate Lua
> states when using LuaJIT 2.0.0 beta 6? As far as I can tell, it
> works fine on vanilla Lua 5.1.4.
AFAIK this works just fine. The only thing you must not do is to
mix up these independent states or to access a single state from
two different threads at the same time. Maybe reduce your code to
a small test case and post it here?
--Mike