Просмотр исходного кода

Lua: Fix element:DispatchEvent iteration over parameters.

Michael Ragazzon 5 лет назад
Родитель
Сommit
4520b5210c
3 измененных файлов с 3 добавлено и 1 удалено
  1. 1 0
      Source/Lua/Element.cpp
  2. 1 1
      Source/Lua/Interpreter.cpp
  3. 1 0
      changelog.md

+ 1 - 0
Source/Lua/Element.cpp

@@ -146,6 +146,7 @@ int ElementDispatchEvent(lua_State* L, Element* obj)
         default:
             break;
         }
+        lua_pop(L, 1); //pops value, leaves key for next iteration
     }
     obj->DispatchEvent(event, params);
     return 0;

+ 1 - 1
Source/Lua/Interpreter.cpp

@@ -89,7 +89,7 @@ bool Interpreter::LoadFile(const String& file)
         Log::Message(Log::LT_WARNING, "LoadFile: File is 0 bytes in size: %s", file.c_str());
         return false;
     }
-    std::unique_ptr<char[]> file_contents(new char[size]);
+    UniquePtr<char[]> file_contents(new char[size]);
     file_interface->Read(file_contents.get(), size, handle);
     file_interface->Close(handle);
 

+ 1 - 0
changelog.md

@@ -118,6 +118,7 @@ Improved Lua plugin in several aspects.
 - Added detailed [documentation for the Lua plugin](https://mikke89.github.io/RmlUiDoc/pages/lua_manual.html). [RmlUiDocs#4](https://github.com/mikke89/RmlUiDoc/pull/4) (thanks @IronicallySerious)
 - Remove overriding globals, use standard pairs/ipars implementation, make array indices 1-based. [#95](https://github.com/mikke89/RmlUi/issues/95) [#137](https://github.com/mikke89/RmlUi/pull/137) (thanks @actboy168)
 - Improve compatibility with debuggers and fix compatibility with Lua 5.4. [#136](https://github.com/mikke89/RmlUi/pull/136) [#138](https://github.com/mikke89/RmlUi/pull/138) (thanks @actboy168)
+- Add stack trace to Lua error messages. [#140](https://github.com/mikke89/RmlUi/pull/140) (thanks @actboy168)
 
 ### Input