Skip to content

Next: InvokeWithObject

Archie_UwU edited this page Apr 12, 2024 · 3 revisions

Invokes a caller-defined function in the context of an object, similar to the with iterator.

Syntax

AurieStatus InvokeWithObject(
    [in] const RValue&      Object,
    [in] std::function<...> Method
);

Parameters

Object

An RValue storing either a string or a numeric type. If the RValue stores a string (VALUE_STRING), the function treats this string as the name of an object asset. The Method function will be invoked for every active instance of this object in the current room. If the RValue stores a numeric type (VALUE_REAL, VALUE_INT32, or VALUE_INT64), the function treats the value as an instance ID. The Method function will only be invoked once.

Method

A pointer to a caller-defined callback function. This function is called for every instance matching the searched object (see Object parameter for more information). The function should be of the following prototype:

void ExampleFunction(
    [in] CInstance* Self,
    [in] CInstance* Other
);

The Self and Other parameters always point to the same instance.

Note

Keep in mind that functions such as CallBuiltin will still operate on the global context.

For calling built-in functions in the current context, use CallBuiltinEx and specify the Self and Other parameters yourself.

Return Value

The function returns AURIE_SUCCESS on success, otherwise returns a matching error code. If an unsupported data type was passed in the Object parameter, the function returns AURIE_NOT_IMPLEMENTED. If Object represents a string, and no instances of the object asset exist, the function returns AURIE_OBJECT_NOT_FOUND.

Quick Access

Documentation

Writeups

Clone this wiki locally