From f8972f866d815de164f64f7ace8a627ad2890457 Mon Sep 17 00:00:00 2001 From: Earu Date: Tue, 3 Aug 2021 13:38:07 +0200 Subject: [PATCH] fix for people manually downloading easychat and renaming the folder --- lua/easychat/engine_chat_hack.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/easychat/engine_chat_hack.lua b/lua/easychat/engine_chat_hack.lua index 28a54b5..246392e 100644 --- a/lua/easychat/engine_chat_hack.lua +++ b/lua/easychat/engine_chat_hack.lua @@ -196,14 +196,17 @@ if CLIENT then is_chat_opened = false end) - local STACK_OFFSET = 4 -- we start at 4 because to ignore all the calls from the interns of easychat + local STACK_OFFSET = 4 -- we start at 4 to ignore all the calls from the internals of easychat local function is_easychat_calling() local data = debug.getinfo(STACK_OFFSET) if data then - local ret = data.source:match("^@lua/easychat") ~= nil + local ret = data.source:match("^@lua/easychat") ~= nil or data.source:match("^@addons/easychat/lua/easychat") ~= nil if ret then return true end - return data.source:match("^@addons/easychat/lua/easychat") ~= nil + if data.source:match("^@addons") then + local chunks = data.source:Split("/") + return chunks[1] == "@addons" and chunks[3] == "lua" and chunks[4] == "easychat" + end end return false