local function g(g,h,...)if not h then local h=...error(debug.traceback(g,h),2)end if coroutine.status(g)~="\100\101\097\100"then error(debug.traceback(g,"\065\116\116\101\109\112\116\101\100 \116\111 \121\105\101\108\100 \105\110\115\105\100\101 \099\104\097\110\103\101\100 \101\118\101\110\116\033"),2)end return...end local function h(h,...)local l=coroutine.create(h)return g(l,coroutine.resume(l,...))end return h
--[[
	Calls a function and throws an error if it attempts to yield.

	Pass any number of arguments to the function after the callback.

	This function supports multiple return; all results returned from the
	given function will be returned.
]]

local function resultHandler(co, ok, ...)
	if not ok then
		local message = (...)
		error(debug.traceback(co, message), 2)
	end

	if coroutine.status(co) ~= "dead" then
		error(debug.traceback(co, "Attempted to yield inside changed event!"), 2)
	end

	return ...
end

local function NoYield(callback, ...)
	local co = coroutine.create(callback)

	return resultHandler(co, coroutine.resume(co, ...))
end

return NoYield
