coroutine.yield

From Garry's Mod
Jump to: navigation, search
 coroutine.yield( )

Contents

Description

Pauses the active coroutine and passes all additional variables to the call of coroutine.resume that resumed the coroutine last time, and returns all additional variables that were passed to the previous call of resume.

Arguments

vararg returnValue

Arguments to be returned by the last call of coroutine.resume

Returns

vararg

Arguments that were set previously by coroutine.resume

Examples

Example

Demonstrates the use of using varargs as a return value.

local co = coroutine.create( function()
	coroutine.yield( "Hello world!" )
end )
print( coroutine.resume( co ) )

Output:

true, "Hello world!"
Personal tools
Navigation