From 81512550bbf997842bf01c66bdf5885bb00fd430 Mon Sep 17 00:00:00 2001 From: Max Cahill <1bardesign@gmail.com> Date: Thu, 9 Jun 2022 16:36:02 +1000 Subject: [PATCH] fixed possible stack overflow in deep_copy --- tablex.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tablex.lua b/tablex.lua index 29ce078..1301e67 100644 --- a/tablex.lua +++ b/tablex.lua @@ -361,11 +361,11 @@ local function _deep_copy_impl(t, already_copied) else --a plain table to clone clone = {} + already_copied[t] = clone for k, v in pairs(t) do clone[k] = _deep_copy_impl(v, already_copied) end setmetatable(clone, getmetatable(t)) - already_copied[t] = clone end end return clone