Types

Link copied to clipboard
class Boolean : Value

A boolean.

Link copied to clipboard
data class Bytes(val value: ByteArray, var metatable: Value.Table? = Companion.metatable) : Value

A byte array.

Link copied to clipboard
data class List(val value: MutableList<Value> = mutableListOf(), var metatable: Value.Table? = Companion.metatable) : Value, MutableList<Value>

A list.

Link copied to clipboard
data class Native(val value: Any, var metatable: Value.Table? = null) : Value

Wraps a native object.

Link copied to clipboard
data object Null : Value

A null value.

Link copied to clipboard
class Number : Value

A number.

Link copied to clipboard
data class String(val value: String) : Value

A string.

Link copied to clipboard
data class Table(val value: MutableMap<Value, Value> = mutableMapOf(), var metatable: Value.Table? = Companion.metatable) : Value, MutableMap<Value, Value>

A table.

Properties

Link copied to clipboard
abstract 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.