モジュール:サンドボックス/MysteryPedia/Console
表示
モジュールの解説[作成]
-- Settings
--
-- Debugging functions for the Debug console.
local export = {}
local hostObjects = {}
function export.attach(target)
local mt = { __index = export }
setmetatable(target, mt)
hostObjects[target] = target
end
-- TEST:
function export.getHostObjects()
return mw.clone(hostObjects)
end
function export.frame(...)
return mw.getCurrentFrame():newChild({ args = {...} })
end
-- e.g. "= p.invoke(p.order, 1)" into the Debug console
function export.invoke(funcName, ...)
return funcName(mw.getCurrentFrame():newChild({ args = {...} }))
end
function export.str(obj)
return mw.logObject(obj)
end
function export.define(source)
for name, fun in pairs(source) do
export[name] = fun
end
end
function export.traceback(frame)
return debug.traceback()
end
function export.iota(size)
local t = {}
for i = 1, size, 1 do
table.insert(t, i)
end
return t
end
return export