diff --git a/debugger.lua b/debugger.lua index 8d638e3..2bc63fb 100644 --- a/debugger.lua +++ b/debugger.lua @@ -3,6 +3,7 @@ local function copyObject(o) for k,v in pairs(o) do obj[k] = v end + setmetatable(obj, getmetatable(o)) return obj end @@ -13,9 +14,12 @@ local function execDebug(env) return false, result[2] end - local func = load(result[2], "debug", "bt", env) + local func = load("return " .. result[2], "debug", "bt", env) if type(func) ~= "function" then - return false, func + func = load(result[2], "debug", "bt", env) + if type(func) ~= "function" then + return false, func + end end return pcall(func)