coxpt = {}
setmetatable(coxpt, {__mode = "kv"})
---- Identity function for copcall
+-- Identity function for copcall
local function copcall_id(trace, ...)
return ...
end
return coxpcall(f, copcall_id, ...)
end
---- Handle return value of protected call
+-- Handle return value of protected call
function handleReturnValue(err, co, status, ...)
if not status then
return false, err(debug.traceback(co, (...)), ...)
end
end
---- Resume execution of protected function call
+-- Resume execution of protected function call
function performResume(err, co, ...)
return handleReturnValue(err, co, coroutine.resume(co, ...))
end