diff options
author | Jeija <norrepli@gmail.com> | 2016-12-31 10:43:45 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2016-12-31 10:43:45 +0100 |
commit | 8743699298dcd2bbe8096bd27dd4bb1f67ce0974 (patch) | |
tree | ca55108bb00b1a7c81155efc77936f09feb53162 | |
parent | 703e6fdadb5251b6f42e35f0f71f3094f5e15f75 (diff) | |
download | mesecons-8743699298dcd2bbe8096bd27dd4bb1f67ce0974.tar mesecons-8743699298dcd2bbe8096bd27dd4bb1f67ce0974.tar.gz mesecons-8743699298dcd2bbe8096bd27dd4bb1f67ce0974.tar.bz2 mesecons-8743699298dcd2bbe8096bd27dd4bb1f67ce0974.tar.xz mesecons-8743699298dcd2bbe8096bd27dd4bb1f67ce0974.zip |
Luacontroller: Fix bugs in 703e6fda, no more functions as keys
Thanks to @ShadowNinja for reporting this
Make sure functions that are keys in tables and functions inside nested tables also get removed when using digiline_send.
-rw-r--r-- | mesecons/util.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mesecons/util.lua b/mesecons/util.lua index 0a06401..b9b0cef 100644 --- a/mesecons/util.lua +++ b/mesecons/util.lua @@ -157,10 +157,12 @@ function mesecon.tablecopy_stripfunctions(table) -- deep table copy, but remove local newtable = {} for idx, item in pairs(table) do - if type(item) == "table" then - newtable[idx] = mesecon.tablecopy(item) - elseif type(item) ~= "function" then - newtable[idx] = item + if type(idx) ~= "function" then + if type(item) == "table" then + newtable[idx] = mesecon.tablecopy_stripfunctions(item) + elseif type(item) ~= "function" then + newtable[idx] = item + end end end |