diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 03:45:02 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 03:45:02 +0200 |
commit | 3e95b8a1587ebce9443d4d716645798bfbb630f2 (patch) | |
tree | b39df9c89aa2e9849ccffce96e92d6b7e456731d /src/script.cpp | |
parent | e8539d4dae46c926553ef0fa76afeaf6be6ecafb (diff) | |
download | minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.tar.gz minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.tar.bz2 minetest-3e95b8a1587ebce9443d4d716645798bfbb630f2.zip |
Determine light_propagates from paramtype
Diffstat (limited to 'src/script.cpp')
-rw-r--r-- | src/script.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/script.cpp b/src/script.cpp index 8b1b7013e..14c23e009 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -35,13 +35,19 @@ LuaError::LuaError(lua_State *L, const std::string &s) { m_s = "LuaError: "; m_s += s + "\n"; + m_s += script_get_backtrace(L); +} + +std::string script_get_backtrace(lua_State *L) +{ + std::string s; lua_getfield(L, LUA_GLOBALSINDEX, "debug"); if(lua_istable(L, -1)){ lua_getfield(L, -1, "traceback"); if(lua_isfunction(L, -1)){ lua_call(L, 0, 1); if(lua_isstring(L, -1)){ - m_s += lua_tostring(L, -1); + s += lua_tostring(L, -1); } lua_pop(L, 1); } @@ -50,6 +56,7 @@ LuaError::LuaError(lua_State *L, const std::string &s) } } lua_pop(L, 1); + return s; } void script_error(lua_State *L, const char *fmt, ...) |