Skip to content

Commit d4e05f3

Browse files
authoredJul 23, 2018
Fix Luacontroller’s print() (#422)
Because of working inside the sandbox, it was unable to print tables.
1 parent 334400a commit d4e05f3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎mesecons_luacontroller/init.lua

+4
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ end
198198
-------------------------
199199

200200
local function safe_print(param)
201+
local string_meta = getmetatable("")
202+
local sandbox = string_meta.__index
203+
string_meta.__index = string -- Leave string sandbox temporarily
201204
print(dump(param))
205+
string_meta.__index = sandbox -- Restore string sandbox
202206
end
203207

204208
local function safe_date()

0 commit comments

Comments
 (0)
Please sign in to comment.