Added more bindings and error tracebacks.
This commit is contained in:
12
helper.lua
12
helper.lua
@@ -8,6 +8,13 @@ end
|
||||
function log(...)
|
||||
old_print(...)
|
||||
end
|
||||
function map(tab,func)
|
||||
local new = {}
|
||||
for index,item in pairs(tab) do
|
||||
new[index] = func(item)
|
||||
end
|
||||
return new
|
||||
end
|
||||
-- HELPER FUNCTIONS
|
||||
-- Insert every item in t1 into t0
|
||||
function just(...)
|
||||
@@ -105,7 +112,8 @@ end
|
||||
-- Runs a function
|
||||
function assert_meta(...)
|
||||
local metas = {...}
|
||||
return function(x,raise)
|
||||
return function(x,raise,handler)
|
||||
handler = handler or error
|
||||
local meta = getmetatable(x)
|
||||
for tab in iterate(metas) do
|
||||
if meta == tab then return end
|
||||
@@ -124,7 +132,7 @@ function assert_meta(...)
|
||||
level = 3
|
||||
msg = string.format(raise,msg)
|
||||
end
|
||||
error(msg,level)
|
||||
handler(msg,level)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user