lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


	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