refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-09-05 08:07:40 +02:00
parent ff4ce0d288
commit 9576b9fe31
5 changed files with 15 additions and 33 deletions
-17
View File
@@ -4,23 +4,6 @@ local setfenv, getmetatable, setmetatable, type, unpack, next, _G = setfenv, get
local PUBLIC, PRIVATE = 1, 2
local CALL, INDEX, NEWINDEX = 1, 2, 3
local inspect
do local function print(msg) DEFAULT_CHAT_FRAME:AddMessage(RED_FONT_COLOR_CODE .. msg) end
local mt = {__metatable=false, __pow=function(self, v) self(v); return v end}
function mt:__call(...)
for i = 1, arg.n do
print('arg' .. i..' = ' .. (type(arg[i]) == 'string' and '"' .. arg[i] .. '"' or tostring(arg[i])))
if type(arg[i]) == 'table' and next(arg[i]) then
print('{')
for k, v in arg[i] do print(' ' .. (type(k) == 'string' and k or '[' .. tostring(k) .. ']') .. ' = ' .. (type(v) == 'string' and '"' .. v..'"' or tostring(v))) end
print('}')
end
end
return unpack(arg)
end
inspect = setmetatable({}, mt)
end
local function error(msg, ...) return _G.error(format(msg or '', unpack(arg)) .. '\n' .. debugstack(), 0) end
local function import_error() error('Import error.') end
local function declaration_error() error('Declaration error.') end