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

Fix script error reporting a bit

This commit is contained in:
Perttu Ahola 2011-12-02 22:49:54 +02:00
parent 9344816bd6
commit 581f950e10
5 changed files with 48 additions and 8 deletions

View file

@ -1101,7 +1101,10 @@ static int l_register_craft(lua_State *L)
width = colcount;
} else {
if(colcount != width){
script_error(L, "error: %s\n", "Invalid crafting recipe");
std::string error;
error += "Invalid crafting recipe (output=\""
+ output + "\")";
throw LuaError(error);
}
}
// removes value, keeps key for next iteration
@ -2469,6 +2472,21 @@ void scriptapi_export(lua_State *L, Server *server)
ObjectRef::Register(L);
}
bool scriptapi_loadmod(lua_State *L, const std::string &scriptpath,
const std::string &modname)
{
bool success = false;
try{
success = script_load(L, scriptpath.c_str());
}
catch(LuaError &e){
errorstream<<"Error loading mod: "<<e.what()<<std::endl;
}
return success;
}
void scriptapi_add_environment(lua_State *L, ServerEnvironment *env)
{
realitycheck(L);