summaryrefslogtreecommitdiff
path: root/mesecons
diff options
context:
space:
mode:
authorVitaliy <numzer0@yandex.ru>2019-09-21 21:09:46 +0000
committersfan5 <sfan5@live.de>2019-09-23 19:50:04 +0200
commit1b54011b6813eeacf6e2c8c0ba61680b66d9ab45 (patch)
treed956dac9cd79211619851ee30b14534822e4b20a /mesecons
parent15e743629e60fd7b588383c4fd855d51d1859693 (diff)
downloadmesecons-1b54011b6813eeacf6e2c8c0ba61680b66d9ab45.tar
mesecons-1b54011b6813eeacf6e2c8c0ba61680b66d9ab45.tar.gz
mesecons-1b54011b6813eeacf6e2c8c0ba61680b66d9ab45.tar.bz2
mesecons-1b54011b6813eeacf6e2c8c0ba61680b66d9ab45.tar.xz
mesecons-1b54011b6813eeacf6e2c8c0ba61680b66d9ab45.zip
Use table.copy in mesecons.tablecopy
mesecons.tablecopy didn’t support recursive tables, while Minetest table.copy works well for them.
Diffstat (limited to 'mesecons')
-rw-r--r--mesecons/util.lua16
1 files changed, 4 insertions, 12 deletions
diff --git a/mesecons/util.lua b/mesecons/util.lua
index b15858d..7485cac 100644
--- a/mesecons/util.lua
+++ b/mesecons/util.lua
@@ -186,19 +186,11 @@ function mesecon.invertRule(r)
return vector.multiply(r, -1)
end
-function mesecon.tablecopy(table) -- deep table copy
- if type(table) ~= "table" then return table end -- no need to copy
- local newtable = {}
-
- for idx, item in pairs(table) do
- if type(item) == "table" then
- newtable[idx] = mesecon.tablecopy(item)
- else
- newtable[idx] = item
- end
+function mesecon.tablecopy(obj) -- deep copy
+ if type(obj) == "table" then
+ return table.copy(obj)
end
-
- return newtable
+ return obj
end
function mesecon.cmpAny(t1, t2)