[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: xpcall(f arguments?,f error)
- From: Tomas <tomas@...>
- Date: Tue, 13 Jul 2004 09:27:26 -0300 (BRT)
Hi Markus,
I think you might want something like:
-- untested code
function my_xpcall (f, ...)
local result = xpcall (function () return f(unpack(arg)) end,
function (msg)
-- build the error message
return msg..'\n'..debug.traceback()..'\n'..os.date()
end)
if not result[1] then
-- throw an error
end
-- remove status code
table.remove (result, 1)
return unpack (result)
end
You can modify it to return the status code (a boolean) or to add
more info to the error message...
I hope it will clarify the mechanism,
Tomas