Skip to content

K.Machine ​

Functions ​

K.Machine.Define ​

lua
K.Machine.Define(name: any, options: any): Machine

K.Machine(name?, options): a named machine reaches clients; without a name it's private. On clients, K.Machine(name) returns the named machine to read.

K.Machine.Get ​

lua
K.Machine.Get(name: string): Machine

Methods on machine ​

machine:State ​

lua
machine:State(): string

machine:Is ​

lua
machine:Is(name: string): boolean

machine:TimeLeft ​

lua
machine:TimeLeft(): number

Seconds until the state's Duration runs out (0 without one).

machine:TimeIn ​

lua
machine:TimeIn(): number

Seconds since the machine entered its current state.

machine:Go ​

lua
machine:Go(name: string)

Moves to a state now (running Exit and Enter).

machine:OnChanged ​

lua
machine:OnChanged(callback: (string, string?) -> ())

callback(new, old) after every move.

machine:OnEnter ​

lua
machine:OnEnter(state: string, callback: (any, string?) -> ())

callback(machine, oldState) whenever the machine enters state, from any script.

machine:OnExit ​

lua
machine:OnExit(state: string, callback: (any, string) -> ())

callback(machine, newState) whenever the machine leaves state.

machine:Stop ​

lua
machine:Stop()

Stops the machine for good (the current state's Exit doesn't run).

Generated from src/Corode/Machine.luau.

Corode 0.13.0 · MIT License