Skip to content

ludus::runtime::behavior

Ludus Wiki · API overview · Browse API

Namespace

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

Enumerations

Kind

enum class Kind : uint8
Supported copied value kinds; no language object or native pointer is a value.

Related types: uint8

Uint32

Uint32 = 1
Exact unsigned 32-bit integer.

Boolean

Boolean = 2
Boolean; scalar representation is zero or one.

Entity

Entity = 3
Generation-checked, execution-scoped entity reference.

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

CommandStatus

enum class CommandStatus : uint8
Explicit command admission result; rejection does not append a command.

Related types: uint8

Accepted

Accepted
Staged; the game has not applied the command yet.

InvalidValue

InvalidValue
Unknown operation, wrong arity/type or out-of-range value.

InvalidEntity

InvalidEntity
Wrong world/session/execution or dead entity generation.

InvalidPhase

InvalidPhase
Invocation is outside the operation's phase.

MissingCapability

MissingCapability
Invocation lacks the required capability bits.

CapacityExceeded

CapacityExceeded
Sixteen commands are already staged.

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

Status

enum class Status : uint8
Synchronous provider result. Every failure preserves the caller's Outcome.

Related types: uint8

Completed

Completed
A validated candidate outcome was copied to the caller.

InvalidContract

InvalidContract
Contract descriptors are invalid or unsupported.

InvalidPackage

InvalidPackage
Trusted package layout, profile, contract or revision mismatch.

InvalidInput

InvalidInput
Identity or input record violates the contract.

NotReady

NotReady
No active package, or provider needs loading after a script fault.

Reentrant

Reentrant
Nested invocation/load/close is forbidden.

AllocationFailure

AllocationFailure
Bounded provider/VM allocation failed.

ScriptFault

ScriptFault
Runtime error or invalid declared state; VM retired.

Interrupted

Interrupted
Cooperative safepoint limit exceeded; VM retired.

Paused

Paused
Debugger owns a partial invocation; no state/effects have published.

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

DebugMode

enum class DebugMode : uint8
Explicit debugger resume policy; no gameplay coroutine or continuation is exposed.

Related types: uint8

Continue

Continue
Run until the next breakpoint or completion.

Into

Into
Stop at the next executable source line.

Over

Over
Stop at the next line at the same or shallower call depth.

Out

Out
Stop after returning to the caller.

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

Aliases

NativeHandler

using ludus::runtime::behavior::NativeHandler = Status (*)(Transaction&, void*) noexcept
Trusted native gameplay callback. Arbitrary C++ remains outside a sandbox.

Related types: Transaction · Status

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

Functions

ExecuteNative

Status ludus::runtime::behavior::ExecuteNative(const Contract &contract, const Invocation &input, Services services, NativeHandler handler, void *user, Outcome &output) noexcept
Executes a native callback through the same checked state/command contract.

Note

Owner-thread only. Callback/services/context must outlive the call; output is preserved on failure.

Related types: NativeHandler · Status · Contract · Invocation · Outcome · Services

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

LuauProfile

std::string_view ludus::runtime::behavior::LuauProfile() noexcept
Exact reviewed runtime-profile fingerprint required by cooked packages (64 lowercase hex bytes).

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

EncodeState

bool ludus::runtime::behavior::EncodeState(const Contract &contract, const Record &state, std::span< uint8 > output, usize &written) noexcept
Encodes declared scalar state as bounded, versioned little-endian records with the contract digest.

Note

Preserves output and written on failure. No native layout, entity or VM object is serialized.

Related types: uint8 · usize · Contract · Record

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

DecodeState

bool ludus::runtime::behavior::DecodeState(const Contract &contract, std::span< const uint8 > bytes, Record &output) noexcept
Decodes an exact-contract state record; rejects trailing bytes and preserves output on failure.

Related types: uint8 · Contract · Record

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h

MigrateState

bool ludus::runtime::behavior::MigrateState(const Record &source, const Contract &target, Record &output) noexcept
Migrates scalar state by field ID; missing new fields use defaults, removed/changed/out-of-range fields fail.

Note

Validates the source record's scalar representation and preserves output on failure; this is an explicit owner policy.

Related types: Contract · Record

Declared in modules/runtime/behavior/include/ludus/runtime/behavior/behavior.h