dao::script::Array

class

A script array that your plugin owns (dao/core/ScriptArray.h), such as one popped off the stack.

When the Array is destroyed, it has the engine free the array. Move-only. A popped array shares its elements with the VM’s copy. The element getters return an empty value (0, kInvalidObject, an empty string or null) if the index is out of range or the array holds another type.

A default-constructed Array holds no array, and the stack refuses to push it. To pass an empty array, create one with Empty:

dao::script::api::LoadCutscene(L"bed110cs_tainted_mirror.cut", player, 1,
    dao::script::Array::Empty(dao::core::ArrayTag::String),
    dao::script::Array::Empty(dao::core::ArrayTag::Object), 0);

Declared in dao/Script.h.

Functions

Array()

Array()=default

Array()

Array(Array &&other) noexcept

Array()

Array(const Array &)=delete

Array()

Array(core::ArrayRep *array)

Takes ownership of an engine array.

Effect()

const CGameEffect * Effect(std::size_t index) const

an effect element, or null

Empty()

static Array Empty(core::ArrayTag kind)

Creates an empty array of the given type, the same way the engine does.

Returns the array, or no array if the engine could not allocate it

Event()

const CScriptEvent * Event(std::size_t index) const

an event element, or null

Float()

float Float(std::size_t index) const

a float element, or 0.0

get()

core::ArrayRep * get() const

Returns the engine’s array, or null if there is none.

Int()

std::int32_t Int(std::size_t index) const

an int element, or 0

Object()

ObjectId Object(std::size_t index) const

an object element, or kInvalidObject

operator bool()

operator bool() const

Returns whether there is an array.

operator=()

Array & operator=(Array &&other) noexcept

operator=()

Array & operator=(const Array &)=delete

Size()

std::size_t Size() const

Returns the number of elements, or 0 if there is no array.

String()

std::wstring_view String(std::size_t index) const

a string element, or empty

Structure()

const void * Structure(std::size_t index) const

Returns an element of an array of engine structures, or null if there is none.

Tag()

std::int32_t Tag() const

Returns the array’s tag, which says what type it holds (core::ArrayTag), or 0 if there is no array.

~Array()

~Array()