Class Coroutine
A class representing a script coroutine
Inherited Members
Namespace: System.Dynamic.ExpandoObject
Assembly: cs.temp.dll.dll
Syntax
public class Coroutine : RefIdObject, IScriptPrivateResource
Properties
AutoYieldCounter
Gets or sets the automatic yield counter.
Declaration
public long AutoYieldCounter { get; set; }
Property Value
System.Int64
The automatic yield counter. |
OwnerScript
Gets the script owning this resource.
Declaration
public Script OwnerScript { get; }
Property Value
Script
The script owning this resource. |
Implements
Exceptions
System.NotImplementedException
|
State
Gets the coroutine state.
Declaration
public CoroutineState State { get; }
Property Value
CoroutineState
|
Type
Gets the type of coroutine
Declaration
public Coroutine.CoroutineType Type { get; }
Property Value
Coroutine.CoroutineType
|
Methods
AsEnumerable()
Gets this coroutine as a typed enumerable which can be looped over for resuming. Returns its result as System.Object. Only the first element of tuples is returned. Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Declaration
public IEnumerable<object> AsEnumerable()
Returns
IEnumerable<System.Object>
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
AsEnumerable<T>()
Gets this coroutine as a typed enumerable which can be looped over for resuming. Returns its result as the specified type. Only the first element of tuples is returned. Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Declaration
public IEnumerable<T> AsEnumerable<T>()
Returns
IEnumerable<T>
|
Type Parameters
T
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
AsTypedEnumerable()
Gets this coroutine as a typed enumerable which can be looped over for resuming. Returns its result as DynValue(s)
Declaration
public IEnumerable<DynValue> AsTypedEnumerable()
Returns
IEnumerable<DynValue>
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
AsUnityCoroutine()
The purpose of this method is to convert a MoonSharp/Lua coroutine to a Unity3D coroutine. This loops over the coroutine, discarding returned values, and returning null for each invocation. This means however that the coroutine will be invoked each frame. Only non-CLR coroutines can be resumed with this method. Use an overload of the Resume method accepting a ScriptExecutionContext instead.
Declaration
public IEnumerator AsUnityCoroutine()
Returns
System.Collections.IEnumerator
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
GetStackTrace(Int32, SourceRef)
Gets the coroutine stack trace for debug purposes
Declaration
public WatchItem[] GetStackTrace(int skip, SourceRef entrySourceRef = null)
Parameters
System.Int32
skip
The skip. |
SourceRef
entrySourceRef
The entry source reference. |
Returns
WatchItem[]
|
Resume()
Resumes the coroutine. Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
Declaration
public DynValue Resume()
Returns
DynValue
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
Resume(DynValue[])
Resumes the coroutine. Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
Declaration
public DynValue Resume(params DynValue[] args)
Parameters
DynValue[]
args
The arguments. |
Returns
DynValue
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead |
Resume(ScriptExecutionContext)
Resumes the coroutine.
Declaration
public DynValue Resume(ScriptExecutionContext context)
Parameters
ScriptExecutionContext
context
The ScriptExecutionContext. |
Returns
DynValue
|
Resume(ScriptExecutionContext, DynValue[])
Resumes the coroutine.
Declaration
public DynValue Resume(ScriptExecutionContext context, params DynValue[] args)
Parameters
ScriptExecutionContext
context
The ScriptExecutionContext. |
DynValue[]
args
The arguments. |
Returns
DynValue
|
Resume(ScriptExecutionContext, Object[])
Resumes the coroutine
Declaration
public DynValue Resume(ScriptExecutionContext context, params object[] args)
Parameters
ScriptExecutionContext
context
The ScriptExecutionContext. |
System.Object[]
args
The arguments. |
Returns
DynValue
|
Resume(Object[])
Resumes the coroutine. Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead.
Declaration
public DynValue Resume(params object[] args)
Parameters
System.Object[]
args
The arguments. |
Returns
DynValue
|
Exceptions
System.InvalidOperationException
Only non-CLR coroutines can be resumed with this overload of the Resume method. Use the overload accepting a ScriptExecutionContext instead. |