aboutsummaryrefslogtreecommitdiff
path: root/builtin/common
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/common')
-rw-r--r--builtin/common/misc_helpers.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index 48488ab62..0b608126e 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -491,6 +491,18 @@ function core.pos_to_string(pos)
end
--------------------------------------------------------------------------------
+function table.copy(t, seen)
+ local n = {}
+ seen = seen or {}
+ seen[t] = n
+ for k, v in pairs(t) do
+ n[type(k) ~= "table" and k or seen[k] or table.copy(k, seen)] =
+ type(v) ~= "table" and v or seen[v] or table.copy(v, seen)
+ end
+ return n
+end
+
+--------------------------------------------------------------------------------
-- mainmenu only functions
--------------------------------------------------------------------------------
if INIT == "mainmenu" then