Coroutine

class Coroutine(state: State, chunk: Chunk.Instance, args: List<Value>) : Value

An instance of a coroutine.

Parameters

state

The parent state of the coroutine.

chunk

The chunk to run.

args

The arguments to pass to the chunk.

Constructors

Link copied to clipboard
constructor(state: State, chunk: Chunk.Instance, args: List<Value>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override var metatable: Value.Table?

The metatable of this value.

Functions

Link copied to clipboard
inline fun <T> Value.asObj(): T

If this is a Value.Native, returns the native object, otherwise throws an error.

Link copied to clipboard

Converts this value to a kotlin.Boolean, or throws an error if it cannot be converted.

Link copied to clipboard

Converts this value to a Value.Bytes, or throws an error if it cannot be converted.

Link copied to clipboard
inline fun <T : Value> Value.convertTo(): T

Converts this value to a T, or throws an error if it cannot be converted.

Link copied to clipboard

Converts this value to a Double, or throws an error if it cannot be converted.

Link copied to clipboard

Converts this value to a Int, or throws an error if it cannot be converted.

Link copied to clipboard

Converts this value to a Value.List, or throws an error if it cannot be converted.

Link copied to clipboard
fun Value.lookUp(key: Value): Value?

Look up a value in this value, possibly using the metatable.

Link copied to clipboard
open fun lookUpDirect(key: Value): Value?

Look up a value in this value.

Link copied to clipboard
fun Value.lookUpHierarchy(vararg keys: String): Value?

Look up a successive sequence of strings in this value.

Link copied to clipboard

If this value is null, return Value.Null, otherwise return this value.

Link copied to clipboard
fun Value.set(key: Value, value: Value): Boolean

Sets a value in this value, possibly using the metatable.

Link copied to clipboard
open fun setDirect(key: Value, value: Value): Boolean

Set a value in this value.

Link copied to clipboard
fun Value.setOrError(key: Value, value: Value)

Sets a value in this value, or throws an error if it cannot be set.

Link copied to clipboard

Converts this value to a String, or throws an error if it cannot be converted.

Link copied to clipboard

Converts this value to a Value.Table, or throws an error if it cannot be converted.