mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Remove lua_State parameter from LuaError::LuaError
This commit is contained in:
parent
f8b7555558
commit
31fe72dbac
13 changed files with 39 additions and 52 deletions
|
@ -48,7 +48,7 @@ protected:
|
|||
ScriptApiBase *scriptIface = getScriptApiBase(L);
|
||||
T *scriptIfaceDowncast = dynamic_cast<T*>(scriptIface);
|
||||
if (!scriptIfaceDowncast) {
|
||||
throw LuaError(NULL, "Requested unavailable ScriptApi - core engine bug!");
|
||||
throw LuaError("Requested unavailable ScriptApi - core engine bug!");
|
||||
}
|
||||
return scriptIfaceDowncast;
|
||||
}
|
||||
|
|
|
@ -150,16 +150,16 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
if(type == "shaped"){
|
||||
std::string output = getstringfield_default(L, table, "output", "");
|
||||
if(output == "")
|
||||
throw LuaError(NULL, "Crafting definition is missing an output");
|
||||
throw LuaError("Crafting definition is missing an output");
|
||||
|
||||
int width = 0;
|
||||
std::vector<std::string> recipe;
|
||||
lua_getfield(L, table, "recipe");
|
||||
if(lua_isnil(L, -1))
|
||||
throw LuaError(NULL, "Crafting definition is missing a recipe"
|
||||
throw LuaError("Crafting definition is missing a recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
if(!readCraftRecipeShaped(L, -1, width, recipe))
|
||||
throw LuaError(NULL, "Invalid crafting recipe"
|
||||
throw LuaError("Invalid crafting recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
|
||||
CraftReplacements replacements;
|
||||
|
@ -167,7 +167,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
if(!lua_isnil(L, -1))
|
||||
{
|
||||
if(!readCraftReplacements(L, -1, replacements))
|
||||
throw LuaError(NULL, "Invalid replacements"
|
||||
throw LuaError("Invalid replacements"
|
||||
" (output=\"" + output + "\")");
|
||||
}
|
||||
|
||||
|
@ -181,17 +181,17 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
else if(type == "shapeless"){
|
||||
std::string output = getstringfield_default(L, table, "output", "");
|
||||
if(output == "")
|
||||
throw LuaError(NULL, "Crafting definition (shapeless)"
|
||||
throw LuaError("Crafting definition (shapeless)"
|
||||
" is missing an output");
|
||||
|
||||
std::vector<std::string> recipe;
|
||||
lua_getfield(L, table, "recipe");
|
||||
if(lua_isnil(L, -1))
|
||||
throw LuaError(NULL, "Crafting definition (shapeless)"
|
||||
throw LuaError("Crafting definition (shapeless)"
|
||||
" is missing a recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
if(!readCraftRecipeShapeless(L, -1, recipe))
|
||||
throw LuaError(NULL, "Invalid crafting recipe"
|
||||
throw LuaError("Invalid crafting recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
|
||||
CraftReplacements replacements;
|
||||
|
@ -199,7 +199,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
if(!lua_isnil(L, -1))
|
||||
{
|
||||
if(!readCraftReplacements(L, -1, replacements))
|
||||
throw LuaError(NULL, "Invalid replacements"
|
||||
throw LuaError("Invalid replacements"
|
||||
" (output=\"" + output + "\")");
|
||||
}
|
||||
|
||||
|
@ -224,12 +224,12 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
else if(type == "cooking"){
|
||||
std::string output = getstringfield_default(L, table, "output", "");
|
||||
if(output == "")
|
||||
throw LuaError(NULL, "Crafting definition (cooking)"
|
||||
throw LuaError("Crafting definition (cooking)"
|
||||
" is missing an output");
|
||||
|
||||
std::string recipe = getstringfield_default(L, table, "recipe", "");
|
||||
if(recipe == "")
|
||||
throw LuaError(NULL, "Crafting definition (cooking)"
|
||||
throw LuaError("Crafting definition (cooking)"
|
||||
" is missing a recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
|
||||
|
@ -240,7 +240,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
if(!lua_isnil(L, -1))
|
||||
{
|
||||
if(!readCraftReplacements(L, -1, replacements))
|
||||
throw LuaError(NULL, "Invalid replacements"
|
||||
throw LuaError("Invalid replacements"
|
||||
" (cooking output=\"" + output + "\")");
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
else if(type == "fuel"){
|
||||
std::string recipe = getstringfield_default(L, table, "recipe", "");
|
||||
if(recipe == "")
|
||||
throw LuaError(NULL, "Crafting definition (fuel)"
|
||||
throw LuaError("Crafting definition (fuel)"
|
||||
" is missing a recipe");
|
||||
|
||||
float burntime = getfloatfield_default(L, table, "burntime", 1.0);
|
||||
|
@ -264,7 +264,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
if(!lua_isnil(L, -1))
|
||||
{
|
||||
if(!readCraftReplacements(L, -1, replacements))
|
||||
throw LuaError(NULL, "Invalid replacements"
|
||||
throw LuaError("Invalid replacements"
|
||||
" (fuel recipe=\"" + recipe + "\")");
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
}
|
||||
else
|
||||
{
|
||||
throw LuaError(NULL, "Unknown crafting definition type: \"" + type + "\"");
|
||||
throw LuaError("Unknown crafting definition type: \"" + type + "\"");
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
|
|
|
@ -470,7 +470,7 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
|
|||
name = lua_tostring(L, -1);
|
||||
verbosestream<<"register_item_raw: "<<name<<std::endl;
|
||||
} else {
|
||||
throw LuaError(NULL, "register_item_raw: name is not defined or not a string");
|
||||
throw LuaError("register_item_raw: name is not defined or not a string");
|
||||
}
|
||||
|
||||
// Check if on_use is defined
|
||||
|
@ -500,7 +500,7 @@ int ModApiItemMod::l_register_item_raw(lua_State *L)
|
|||
content_t id = ndef->set(f.name, f);
|
||||
|
||||
if(id > MAX_REGISTERED_CONTENT){
|
||||
throw LuaError(NULL, "Number of registerable nodes ("
|
||||
throw LuaError("Number of registerable nodes ("
|
||||
+ itos(MAX_REGISTERED_CONTENT+1)
|
||||
+ ") exceeded (" + name + ")");
|
||||
}
|
||||
|
|
|
@ -330,10 +330,10 @@ int LuaPseudoRandom::l_next(lua_State *L)
|
|||
max = luaL_checkinteger(L, 3);
|
||||
if(max < min){
|
||||
errorstream<<"PseudoRandom.next(): max="<<max<<" min="<<min<<std::endl;
|
||||
throw LuaError(NULL, "PseudoRandom.next(): max < min");
|
||||
throw LuaError("PseudoRandom.next(): max < min");
|
||||
}
|
||||
if(max - min != 32767 && max - min > 32767/5)
|
||||
throw LuaError(NULL, "PseudoRandom.next() max-min is not 32767"
|
||||
throw LuaError("PseudoRandom.next() max-min is not 32767"
|
||||
" and is > 32768/5. This is disallowed due to"
|
||||
" the bad random distribution the"
|
||||
" implementation would otherwise make.");
|
||||
|
|
|
@ -1120,7 +1120,7 @@ int ObjectRef::l_set_sky(lua_State *L)
|
|||
}
|
||||
|
||||
if (type == "skybox" && params.size() != 6)
|
||||
throw LuaError(L, "skybox expects 6 textures");
|
||||
throw LuaError("skybox expects 6 textures");
|
||||
|
||||
if (!getServer(L)->setSky(player, bgcolor, type, params))
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue