1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Handle LuaErrors in Lua -> C++ calls on LuaJIT

This commit is contained in:
ShadowNinja 2013-12-18 16:35:55 -05:00
parent 38d112033b
commit 49cec3f782
18 changed files with 113 additions and 134 deletions

View file

@ -61,7 +61,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowMove(v3s16 p,
scriptError();
lua_remove(L, errorhandler); // Remove error handler
if(!lua_isnumber(L, -1))
throw LuaError(L, "allow_metadata_inventory_move should return a number");
throw LuaError(NULL, "allow_metadata_inventory_move should return a number");
int num = luaL_checkinteger(L, -1);
lua_pop(L, 1); // Pop integer
return num;
@ -99,7 +99,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowPut(v3s16 p,
scriptError();
lua_remove(L, errorhandler); // Remove error handler
if(!lua_isnumber(L, -1))
throw LuaError(L, "allow_metadata_inventory_put should return a number");
throw LuaError(NULL, "allow_metadata_inventory_put should return a number");
int num = luaL_checkinteger(L, -1);
lua_pop(L, 1); // Pop integer
return num;
@ -137,7 +137,7 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowTake(v3s16 p,
scriptError();
lua_remove(L, errorhandler); // Remove error handler
if(!lua_isnumber(L, -1))
throw LuaError(L, "allow_metadata_inventory_take should return a number");
throw LuaError(NULL, "allow_metadata_inventory_take should return a number");
int num = luaL_checkinteger(L, -1);
lua_pop(L, 1); // Pop integer
return num;