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

Determine light_propagates from paramtype

This commit is contained in:
Perttu Ahola 2011-12-04 03:45:02 +02:00
parent e8539d4dae
commit 3e95b8a158
5 changed files with 24 additions and 21 deletions

View file

@ -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, ...)