State

class State(val parentState: State? = null)

Represents the state of a Metis virtual machine. This is the class that is used to run Metis code.

Constructors

Link copied to clipboard
constructor(parentState: State? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The breakpoints of the state. Only used if debugMode is true.

Link copied to clipboard

The current working directory of the state.

Link copied to clipboard

The debug information of the state. Only set if debugMode is true.

Link copied to clipboard

True if the state is in debug mode.

Link copied to clipboard

The FileSystem used by the state.

Link copied to clipboard

The global variables of the state.

Link copied to clipboard
Link copied to clipboard

The offset of the local variables of the current function in the stack.

Link copied to clipboard
val parentState: State? = null
Link copied to clipboard

The recursion limit of the state.

Link copied to clipboard

The stack of the state.

Link copied to clipboard

The standard error stream of the state.

Link copied to clipboard

The standard input stream of the state.

Link copied to clipboard

The standard output stream of the state.

Functions

Link copied to clipboard

Adds a NativeLibrary to the state.

Link copied to clipboard
fun call(nargs: Int, selfProvided: Boolean = false, span: Span? = null)

Calls the top of the stack with nargs arguments.

Link copied to clipboard
fun index()

Performs an index operation on the stack.

Link copied to clipboard
fun is()

Performs a is operation on the top of the stack.

Link copied to clipboard
fun loadChunk(chunk: Chunk)

Loads a chunk into the state but does not call it.

Link copied to clipboard

Loads all the core globals into the state, like print, io, etc.

Link copied to clipboard

Loads the standard library into the state.

Link copied to clipboard
fun metaCall(nargs: Int, metamethod: String, span: Span? = null)

Performs a metamethod call on the value nargs below the top of the stack.

Link copied to clipboard
fun newError(type: String)

Creates a new MetisRuntimeException and pushes it to the stack.

Link copied to clipboard
fun not()

Performs a not operation on the top of the stack.

Link copied to clipboard

Removes a NativeLibrary from the state.

Link copied to clipboard
fun runCode(source: CodeSource)

Loads the given CodeSource and runs it.

Link copied to clipboard

Runs the state till it is finished.

Link copied to clipboard
fun set()

Performs a set operation on the stack.

Link copied to clipboard

Steps the state.

Link copied to clipboard
fun stringify(value: Value): String

Stringifies the given value according to its __str__ metamethod.

Link copied to clipboard
fun wrapToList(values: Int)

Wraps the top values values of the stack into a Value.List.

Link copied to clipboard
fun wrapToTable(values: Int)

Wraps the top values values of the stack into a Value.Table.