From 8743699298dcd2bbe8096bd27dd4bb1f67ce0974 Mon Sep 17 00:00:00 2001
From: Jeija <norrepli@gmail.com>
Date: Sat, 31 Dec 2016 10:43:45 +0100
Subject: [PATCH] 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.
---
 mesecons/util.lua | 10 ++++++----
 1 file 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
 
-- 
GitLab