From 01eec1e9adac8dcf634104e604cf6b791910fba0 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Wed, 8 Sep 2021 13:05:34 -0300 Subject: [PATCH] lets hope this doesn't break anything: returned type by hook is now the last hook registered --- .../BarotraumaServer/ServerSource/Lua/LuaClasses.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs index e901c9742..8281e7c99 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs @@ -596,15 +596,13 @@ namespace Barotrauma if (!hookFunctions.ContainsKey(name)) return null; + object lastResult = null; + foreach (HookFunction hf in hookFunctions[name].Values) { try { - var result = env.lua.Call(hf.function, args); - if (result.IsNil() == false) - { - return result; - } + lastResult = env.lua.Call(hf.function, args); } catch (Exception e) { @@ -612,7 +610,7 @@ namespace Barotrauma } } - return null; + return lastResult; } } }