Next: InvokeWithObject - AurieFramework/YYToolkit GitHub Wiki

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

Value Description
AURIE_SUCCESS The operation completed successfully.
AURIE_NOT_IMPLEMENTED An invalid type was specified for Object.
AURIE_OBJECT_NOT_FOUND No instances of the object exist.

Requirements

Criterium Value
Minimum YYTK Version 3.2.1
Context Engine-synchronous
⚠️ **GitHub.com Fallback** ⚠️