Wrapped the LuaRegister functions in cpcalls to prevent the longjmp from doing too much damage. Added a Lua error handler.