From 5df8aedf087dbdf7d66280c2d283c97c3dd75b46 Mon Sep 17 00:00:00 2001 From: Lion Date: Sat, 11 Dec 2021 10:35:11 +0100 Subject: [PATCH 1/3] Update Changelog.md --- Changelog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 7166f09..a630190 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,7 @@ # v2.4.0 - CHANGED entire plugin Lua implementation (rewrite) -- CHANGED moved *almost all* functions into MP.\* +- CHANGED moved *almost all* Lua functions into MP.\* - CHANGED console to use a custom language (type `help`, `list`, or `status`!) - CHANGED all files of a Lua plugin to share a Lua state (no more state-per-file) - ADDED many new Lua API functions, which can be found at @@ -14,7 +14,7 @@ - ADDED dumping tables with `print()` (try it with `print(MP)`) - ADDED `MP.GetOSName()`, `MP.CreateTimer()`, `MP.GetLuaMemoryUsage()` and many more (see ) - ADDED `MP.Settings` table to make usage of `MP.Set()` easier -- ADDED `FS.*` table with common filesystem operations +- ADDED `FS.*` table with common filesystem operations (do `print(FS)` to see them!) - FIXED i/o thread spin when stdout is /dev/null on linux - FIXED removed extra whitespace infront of onChatMessage message From 71efe303450402ee0f7e041f7582e725cb71e882 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Mon, 13 Dec 2021 13:22:58 +0100 Subject: [PATCH 2/3] Bump to 3.0.0, possible fix for event argument bug --- include/Common.h | 2 +- include/TLuaEngine.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/Common.h b/include/Common.h index 5772317..b75caef 100644 --- a/include/Common.h +++ b/include/Common.h @@ -114,7 +114,7 @@ private: static inline std::mutex mShutdownHandlersMutex {}; static inline std::deque mShutdownHandlers {}; - static inline Version mVersion { 2, 4, 0 }; + static inline Version mVersion { 3, 0, 0 }; }; std::string ThreadName(bool DebugModeOverride = false); diff --git a/include/TLuaEngine.h b/include/TLuaEngine.h index 3b2e070..cc9ee1f 100644 --- a/include/TLuaEngine.h +++ b/include/TLuaEngine.h @@ -133,10 +133,13 @@ public: } std::vector> Results; + std::vector Arguments { TLuaArgTypes { std::forward(Args) }... }; + for (const auto& Event : mLuaEvents.at(EventName)) { for (const auto& Function : Event.second) { if (Event.first != IgnoreId) { - Results.push_back(EnqueueFunctionCall(Event.first, Function, { TLuaArgTypes { std::forward(Args) }... })); + std::vector ArgumentsCopy = Arguments; + Results.push_back(EnqueueFunctionCall(Event.first, Function, ArgumentsCopy)); } } } From 3555cec5fe47a67dc4af06a167e43da626fff59a Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Mon, 13 Dec 2021 13:48:18 +0100 Subject: [PATCH 3/3] Simplify fix for event argument bug --- include/TLuaEngine.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/TLuaEngine.h b/include/TLuaEngine.h index cc9ee1f..1673c61 100644 --- a/include/TLuaEngine.h +++ b/include/TLuaEngine.h @@ -138,8 +138,7 @@ public: for (const auto& Event : mLuaEvents.at(EventName)) { for (const auto& Function : Event.second) { if (Event.first != IgnoreId) { - std::vector ArgumentsCopy = Arguments; - Results.push_back(EnqueueFunctionCall(Event.first, Function, ArgumentsCopy)); + Results.push_back(EnqueueFunctionCall(Event.first, Function, Arguments)); } } }