Skip to content

Commit

Permalink
Fix Luacontroller’s print() (#422)
Browse files Browse the repository at this point in the history
Because of working inside the sandbox, it was unable to print tables.
  • Loading branch information
numberZero authored Jul 23, 2018
1 parent 334400a commit d4e05f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mesecons_luacontroller/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,11 @@ end
-------------------------

local function safe_print(param)
local string_meta = getmetatable("")
local sandbox = string_meta.__index
string_meta.__index = string -- Leave string sandbox temporarily
print(dump(param))
string_meta.__index = sandbox -- Restore string sandbox
end

local function safe_date()
Expand Down

0 comments on commit d4e05f3

Please sign in to comment.