dao::script::Stack

struct

The script VM’s typed stack.

In a handler, each pop takes the next argument, in the order the script passed them, and a push hands the result back to the script. Each returns false, or an empty Owned or Array, if the VM refused: the stack was empty, or the value on top was of another type.

The VM copies any structure or array you push, so you keep your own. A popped one is your own copy, and the Owned or Array it comes in frees it.

Declared in dao/Script.h.

Functions

PopArray()

static Array PopArray()

PopCommand()

static OwnedCommand PopCommand()

PopEffect()

static OwnedEffect PopEffect()

PopEvent()

static OwnedEvent PopEvent()

PopFloat()

static bool PopFloat(float &out)

PopInt()

static bool PopInt(std::int32_t &out)

PopLocation()

static bool PopLocation(CScriptLocation &out)

PopObject()

static bool PopObject(ObjectId &out)

PopResource()

static bool PopResource(Resource &out)

PopString()

static bool PopString(std::wstring &out)

PopStructure()

static void * PopStructure(EngineStructure type)

Pops an engine structure of any type.

Returns the popped copy, which you must free with DestroyStructure; null if the VM refused

PopVector()

static bool PopVector(Vector &out)

PushArray()

static bool PushArray(const Array &value)

Pushes an array.

The VM makes its own copy, which shares the elements. Returns false if there is no array.

PushCommand()

static bool PushCommand(const ::dao::Command &value)

PushEffect()

static bool PushEffect(const CGameEffect &value)

PushEvent()

static bool PushEvent(const CScriptEvent &value)

PushFloat()

static bool PushFloat(float value)

PushInt()

static bool PushInt(std::int32_t value)

PushLocation()

static bool PushLocation(const CScriptLocation &value)

PushObject()

static bool PushObject(ObjectId value)

PushResource()

static bool PushResource(const Resource &value)

PushString()

static bool PushString(std::wstring_view value)

PushStructure()

static bool PushStructure(EngineStructure type, const void *value)

Pushes an engine structure of any type. The VM copies it.

PushVector()

static bool PushVector(const Vector &value)