Skip to content

Api > LuaBehaviour > StartCoroutine()


LuaBehaviour.StartCoroutine(function coroutineFunction, [optionalArguments] args)⚓︎

Starts the passed function as a coroutine function.

Parameters:⚓︎

Name Type Description
coroutineFunction function The name of the function to be started as a coroutine. Must have at least one coroutine.yield() call with in it.
args [optionalArguments] Arguments to passed as parameters to the coroutine function.

Returns:⚓︎

type Description
Coroutine Reference to created coroutine.

Usage⚓︎

---@type LuaBehaviour
local luabehaviour;

---@type function
local coroutineFunction;

---@type [optionalArguments]
local args;


local val0 = luabehaviour.StartCoroutine(coroutineFunction, args)