diff options
author | Sfan5 <sfan5@live.de> | 2014-03-15 14:49:30 +0100 |
---|---|---|
committer | Sfan5 <sfan5@live.de> | 2014-03-15 14:51:00 +0100 |
commit | 362ef5f6ced862daa4733034810d0b07e2ad5d89 (patch) | |
tree | beca839a42d19ec135f84c4c0b894634d281a07b /src/script/cpp_api/s_server.cpp | |
parent | d753d352f15ac3586a80b42dd4da6aca518c8ec8 (diff) | |
download | minetest-362ef5f6ced862daa4733034810d0b07e2ad5d89.tar.gz minetest-362ef5f6ced862daa4733034810d0b07e2ad5d89.tar.bz2 minetest-362ef5f6ced862daa4733034810d0b07e2ad5d89.zip |
Make sure we get a stacktrace for as many lua errors as possible
Diffstat (limited to 'src/script/cpp_api/s_server.cpp')
-rw-r--r-- | src/script/cpp_api/s_server.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/script/cpp_api/s_server.cpp b/src/script/cpp_api/s_server.cpp index 98320b578..4baf90636 100644 --- a/src/script/cpp_api/s_server.cpp +++ b/src/script/cpp_api/s_server.cpp @@ -33,7 +33,7 @@ bool ScriptApiServer::getAuth(const std::string &playername, getAuthHandler(); lua_getfield(L, -1, "get_auth"); if(lua_type(L, -1) != LUA_TFUNCTION) - throw LuaError(NULL, "Authentication handler missing get_auth"); + throw LuaError(L, "Authentication handler missing get_auth"); lua_pushstring(L, playername.c_str()); if(lua_pcall(L, 1, 1, errorhandler)) scriptError(); @@ -48,13 +48,13 @@ bool ScriptApiServer::getAuth(const std::string &playername, std::string password; bool found = getstringfield(L, -1, "password", password); if(!found) - throw LuaError(NULL, "Authentication handler didn't return password"); + throw LuaError(L, "Authentication handler didn't return password"); if(dst_password) *dst_password = password; lua_getfield(L, -1, "privileges"); if(!lua_istable(L, -1)) - throw LuaError(NULL, "Authentication handler didn't return privilege table"); + throw LuaError(L, "Authentication handler didn't return privilege table"); if(dst_privs) readPrivileges(-1, *dst_privs); lua_pop(L, 1); @@ -74,7 +74,7 @@ void ScriptApiServer::getAuthHandler() } lua_remove(L, -2); // Remove minetest if(lua_type(L, -1) != LUA_TTABLE) - throw LuaError(NULL, "Authentication handler table not valid"); + throw LuaError(L, "Authentication handler table not valid"); } void ScriptApiServer::readPrivileges(int index, std::set<std::string> &result) @@ -108,7 +108,7 @@ void ScriptApiServer::createAuth(const std::string &playername, lua_getfield(L, -1, "create_auth"); lua_remove(L, -2); // Remove auth handler if(lua_type(L, -1) != LUA_TFUNCTION) - throw LuaError(NULL, "Authentication handler missing create_auth"); + throw LuaError(L, "Authentication handler missing create_auth"); lua_pushstring(L, playername.c_str()); lua_pushstring(L, password.c_str()); if(lua_pcall(L, 2, 0, errorhandler)) @@ -128,7 +128,7 @@ bool ScriptApiServer::setPassword(const std::string &playername, lua_getfield(L, -1, "set_password"); lua_remove(L, -2); // Remove auth handler if(lua_type(L, -1) != LUA_TFUNCTION) - throw LuaError(NULL, "Authentication handler missing set_password"); + throw LuaError(L, "Authentication handler missing set_password"); lua_pushstring(L, playername.c_str()); lua_pushstring(L, password.c_str()); if(lua_pcall(L, 2, 1, errorhandler)) |