Charakterbewegungen hinzugefügt, Deko hinzugefügt, Kochrezepte angepasst
This commit is contained in:
parent
95945c0306
commit
a0c893ca0b
1124 changed files with 64294 additions and 763 deletions
29
mods/futil/util/exception.lua
Normal file
29
mods/futil/util/exception.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
function futil.safe_wrap(func, rv_on_fail, error_callback)
|
||||
-- wrap a function w/ logic to avoid crashing
|
||||
return function(...)
|
||||
local rvs = { xpcall(func, debug.traceback, ...) }
|
||||
|
||||
if rvs[1] then
|
||||
return unpack(rvs, 2)
|
||||
else
|
||||
if error_callback then
|
||||
error_callback(debug.getinfo(func), { ... }, rvs[2])
|
||||
else
|
||||
futil.log(
|
||||
"error",
|
||||
"(check_call): %s args: %s out: %s",
|
||||
dump(debug.getinfo(func)),
|
||||
dump({ ... }),
|
||||
rvs[2]
|
||||
)
|
||||
end
|
||||
return rv_on_fail
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function futil.safe_call(func, rv_on_fail, error_callback, ...)
|
||||
return futil.safe_wrap(func, rv_on_fail, error_callback)(...)
|
||||
end
|
||||
|
||||
futil.check_call = futil.safe_wrap -- backwards compatibility
|
Loading…
Add table
Add a link
Reference in a new issue