mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02:00
Handle LuaErrors in Lua -> C++ calls on LuaJIT
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user