mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Revert "Make sure we get a stacktrace for as many lua errors as possible"
This reverts commit 362ef5f6ce
.
Stack tracebacks couldn't be generated in LuaError::LuaError anyway and this
caused a second, empty traceback in most cases. In cases where there wasn't
annother traceback the stack had already unwound and the traceback was empty.
This commit is contained in:
parent
23be6450a1
commit
f8b7555558
6 changed files with 29 additions and 29 deletions
|
@ -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(L, "Crafting definition is missing an output");
|
||||
throw LuaError(NULL, "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(L, "Crafting definition is missing a recipe"
|
||||
throw LuaError(NULL, "Crafting definition is missing a recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
if(!readCraftRecipeShaped(L, -1, width, recipe))
|
||||
throw LuaError(L, "Invalid crafting recipe"
|
||||
throw LuaError(NULL, "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(L, "Invalid replacements"
|
||||
throw LuaError(NULL, "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(L, "Crafting definition (shapeless)"
|
||||
throw LuaError(NULL, "Crafting definition (shapeless)"
|
||||
" is missing an output");
|
||||
|
||||
std::vector<std::string> recipe;
|
||||
lua_getfield(L, table, "recipe");
|
||||
if(lua_isnil(L, -1))
|
||||
throw LuaError(L, "Crafting definition (shapeless)"
|
||||
throw LuaError(NULL, "Crafting definition (shapeless)"
|
||||
" is missing a recipe"
|
||||
" (output=\"" + output + "\")");
|
||||
if(!readCraftRecipeShapeless(L, -1, recipe))
|
||||
throw LuaError(L, "Invalid crafting recipe"
|
||||
throw LuaError(NULL, "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(L, "Invalid replacements"
|
||||
throw LuaError(NULL, "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(L, "Crafting definition (cooking)"
|
||||
throw LuaError(NULL, "Crafting definition (cooking)"
|
||||
" is missing an output");
|
||||
|
||||
std::string recipe = getstringfield_default(L, table, "recipe", "");
|
||||
if(recipe == "")
|
||||
throw LuaError(L, "Crafting definition (cooking)"
|
||||
throw LuaError(NULL, "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(L, "Invalid replacements"
|
||||
throw LuaError(NULL, "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(L, "Crafting definition (fuel)"
|
||||
throw LuaError(NULL, "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(L, "Invalid replacements"
|
||||
throw LuaError(NULL, "Invalid replacements"
|
||||
" (fuel recipe=\"" + recipe + "\")");
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ int ModApiCraft::l_register_craft(lua_State *L)
|
|||
}
|
||||
else
|
||||
{
|
||||
throw LuaError(L, "Unknown crafting definition type: \"" + type + "\"");
|
||||
throw LuaError(NULL, "Unknown crafting definition type: \"" + type + "\"");
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue