Browse Source

Show filename for Lua subsystem error messages where possible.

Lasse Öörni 12 năm trước cách đây
mục cha
commit
6229e36a1e

+ 1 - 1
Source/Engine/Engine/Application.cpp

@@ -106,7 +106,7 @@ void Application::HandleLogMessage(StringHash eventType, VariantMap& eventData)
         String error = eventData[P_MESSAGE].GetString();
         unsigned bracketPos = error.Find(']');
         if (bracketPos != String::NPOS)
-            error = error.Substring(bracketPos + 1);
+            error = error.Substring(bracketPos + 2);
         
         startupErrors_ += error + "\n";
     }

+ 2 - 2
Source/Extras/LuaScript/LuaFile.cpp

@@ -103,7 +103,7 @@ bool LuaFile::Execute(lua_State* luaState)
     if (error)
     {
         const char* message = lua_tostring(luaState, -1);
-        LOGERROR("Load Buffer Failed: " + String(message));
+        LOGERROR("Load Buffer failed for " + GetName() + ": " + String(message));
         lua_settop(luaState, top);
         return false;
     }
@@ -111,7 +111,7 @@ bool LuaFile::Execute(lua_State* luaState)
     if (lua_pcall(luaState, 0, 0, 0))
     {
         const char* message = lua_tostring(luaState, -1);
-        LOGERROR("Lua Execute Failed: " + String(message));
+        LOGERROR("Lua Execute failed for " + GetName() + ": " + String(message));
         lua_settop(luaState, top);
         return false;
     }

+ 8 - 8
Source/Extras/LuaScript/LuaScript.cpp

@@ -73,7 +73,7 @@ LuaScript::LuaScript(Context* context) :
     luaState_ = luaL_newstate();
     if (!luaState_)
     {
-        LOGERROR("Could not create Lua state.");
+        LOGERROR("Could not create Lua state");
         return;
     }
 
@@ -131,7 +131,7 @@ bool LuaScript::ExecuteString(const String& string)
     if (luaL_dostring(luaState_, string.CString()) != 0)
     {
         const char* message = lua_tostring(luaState_, -1);
-        LOGERROR("Execute Lua String Failed: " + String(message));
+        LOGERROR("Execute Lua string failed: " + String(message));
         lua_settop(luaState_, top);
         return false;
     }
@@ -154,7 +154,7 @@ bool LuaScript::ExecuteFunction(const String& functionName)
     if (lua_pcall(luaState_, 0, 0, 0))
     {
         const char* message = lua_tostring(luaState_, -1);
-        LOGERROR("Execute Lua Function Failed: " + String(message));
+        LOGERROR("Execute Lua function failed: " + String(message));
         lua_settop(luaState_, top);
         return false;
     }
@@ -223,7 +223,7 @@ int LuaScript::Loader(lua_State* L)
     if (error)
     {
         const char* message = lua_tostring(L, -1);
-        LOGERROR("Execute Lua File Failed: " + String(message));
+        LOGERROR("Execute Lua file " + String(name) + " failed: " + String(message));
         lua_settop(L, top);
         return 0;
     }
@@ -282,7 +282,7 @@ bool LuaScript::FindFunction(const String& functionName)
     {
         if (!lua_istable(luaState_, -1))
         {
-            LOGERROR("Can Not Find Lua Table: " + String("Table Name = '") + currentName + "'.");
+            LOGERROR("Can not find Lua table: " + String("Table name = '") + currentName + "'.");
             return false;
         }
 
@@ -292,7 +292,7 @@ bool LuaScript::FindFunction(const String& functionName)
             lua_getfield(luaState_, -1, splitedNames[i].CString());
             if (!lua_istable(luaState_, -1))
             {
-                LOGERROR("Can Not Find Lua Table: " + String("Table Name = '") + currentName + "'.");
+                LOGERROR("Can not find Lua table: " + String("Table name = '") + currentName + "'.");
                 return false;
             }
         }
@@ -303,7 +303,7 @@ bool LuaScript::FindFunction(const String& functionName)
 
     if (!lua_isfunction(luaState_, -1))
     {
-        LOGERROR("Can Not Find Lua Function: " + String("Function Name = '") + currentName + "'.");
+        LOGERROR("Can not find Lua function: " + String("Function name = '") + currentName + "'.");
         return false;
     }
 
@@ -346,7 +346,7 @@ void LuaScript::CallEventHandler(const String& functionName, StringHash eventTyp
     if (lua_pcall(luaState_, 2, 0, 0) != 0)
     {
         const char* message = lua_tostring(luaState_, -1);
-        LOGERROR("Execute Lua Function Failed: " + String(message));
+        LOGERROR("Execute Lua function failed: " + String(message));
         lua_settop(luaState_, top);
         return;
     }