From d6774da79fd1a45c2c5e12b1bdb232cdfb853424 Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Tue, 1 Dec 2020 19:29:18 +0100 Subject: [PATCH] Implement table.shallowcopy --- table.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/table.lua b/table.lua index ff1e44b..dbf056a 100644 --- a/table.lua +++ b/table.lua @@ -72,6 +72,14 @@ end copy = tablecopy +function shallowcopy(table) + local copy = {} + for key, value in pairs(table) do + copy[key] = value + end + return copy +end + function deepcopy_noncircular(table) local function _copy(value) if type(value) == "table" then