fix: duplicating core:chat event handlers in in-game chat

This commit is contained in:
MihailRis 2026-06-02 23:58:22 +03:00
parent bb135d33b5
commit 52829023c2

View file

@ -19,7 +19,7 @@ local function update_line(line, uptime)
end end
end end
events.on("core:chat", function(message) local core_chat_handler = events.on("core:chat", function(message)
while #lines >= max_lines do while #lines >= max_lines do
document[lines[1][1]]:destruct() document[lines[1][1]]:destruct()
table.remove(lines, 1) table.remove(lines, 1)
@ -52,3 +52,7 @@ function on_open()
end) end)
end end
end end
function on_destroy()
events.remove("core:chat", core_chat_handler)
end