From a5eff7964ccdcaedd8467c32cbcd3a409e1c9185 Mon Sep 17 00:00:00 2001 From: Cooldude2606 Date: Mon, 15 Jun 2020 18:59:11 +0100 Subject: [PATCH] Fixed Potential desync issue --- expcore/external.lua | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/expcore/external.lua b/expcore/external.lua index 745aafa3..61f1d614 100644 --- a/expcore/external.lua +++ b/expcore/external.lua @@ -14,18 +14,11 @@ end ]] -local Event = require 'utils.event' --- @dep utils.event +local ext, var local concat = table.concat local External = {} ---- Makes local links to the data is global.ext if it exists -local ext, var -Event.on_load(function() - ext = global.ext - if ext then var = ext.var end -end) - --[[-- Checks that local links are valid, will try to add the links if invalid @treturn boolean If the external data is valid, if false you should not call any other methods from External @@ -36,14 +29,14 @@ end ]] function External.valid() - if ext ~= nil and ext == global.ext then - return true - elseif global.ext ~= nil then + if global.ext == nil then return false end + if ext == global.ext and var == ext.var then + return var ~= nil + else ext = global.ext var = ext.var return var ~= nil end - return false end --[[-- Gets a table of all the servers, key is the server id, value is the server details