Stopping Lua from closing my application

BlitzMax Forums/BlitzMax Programming/Stopping Lua from closing my application

Hezkore(Posted 2012) [#1]
I can't for the life of me figure out how to stop Lua from closing down my application when a Lua "panic" occurs!

I've specified my own panic function like so:
lua_atpanic(lua, PanicHandler)

Function PanicHandler:Int(ls:Byte Ptr)		
	Print "Lua Error: " + lua_tostring(ls, -1)
	lua_close(ls)
		
	Return(0)
End Function

But it still closes my application at Return(0), even though the function itself does work very well.
I just want to disable the Lua script and continue on with the application.

EDIT:
Well I managed to solve it...
Not sure if this is the best way, but what I did was place a Throw(lua_tostring(ls, -1)) inside the panic function, and using Try when calling the Lua function with the error in it.

Last edited 2012