--- Identity function for copcall
-local function copcall_id(trace, ...)
- return ...
-end
-
--- values of either the function or the error handler
-function coxpcall(f, err, ...)
- local res, co = oldpcall(coroutine.create, f)
- if not res then
- local params = {...}
- local newf = function() return f(unpack(params)) end
- co = coroutine.create(newf)
- end
- local c = coroutine.running()
- coxpt[co] = coxpt[c] or c or 0
-
- return performResume(err, co, ...)
-end
-
--- values of the function or the error object
-function copcall(f, ...)
- return coxpcall(f, copcall_id, ...)
-end
-
--- Handle return value of protected call
-function handleReturnValue(err, co, status, ...)