Skip to content

Next: CallBuiltinEx

Archie_UwU edited this page Dec 25, 2023 · 1 revision

Calls a GameMaker built-in function with user-specified arguments.

Syntax

AurieStatus CallBuiltinEx(
    [out]          RValue&             Result,
    [in]           const char*         FunctionName,
    [in, optional] CInstance*          SelfInstance,
    [in, optional] CInstance*          OtherInstance
    [in]           std::vector<RValue> Arguments
);

Parameters

Result

A reference to a buffer into which the result of the call is written. The buffer referenced by this parameter is guaranteed to remain unchanged if the function fails.

FunctionName

The name of the function to call. This parameter must refer to a built-in function, not a script. Function names are case-sensitive. The function referred to by this parameter is called in the context of the passed in Self and Other instances. If a script name is passed in, the function might crash the game or worse, silently corrupt the stack.

SelfInstance

The instance pointed to by the self keyword in GML. Unless you are calling built-in functions asynchronously from the engine thread (outside of a callback registered by CreateCallback), it is recommended to use the instance used by the current engine event.

OtherInstance

The instance pointed to by the other keyword in GML. Unless you are calling built-in functions asynchronously from the engine thread (outside of a callback registered by CreateCallback), it is recommended to use the instance used by the current engine event.

Arguments

A vector of RValues, containing all the arguments to pass into the built-in function. The order of these arguments is the same as if calling the function from GML itself.

Return Value

On a successful call to a built-in function, the function returns AURIE_SUCCESS and writes the result of the built-in call into the Result buffer. If the function fails, it returns a matching error code. If the internal function lookup isn't available, the function returns AURIE_MODULE_INTERNAL_ERROR. If the function referenced by the Name parameter does not exist, the function returns AURIE_OBJECT_NOT_FOUND.

Remarks

Unlike YYTK v2's Legacy CallBuiltin function, CallBuiltinEx does not implicitly use the global instance if both SelfInstance and OtherInstance are specified as nullptr. To use the global instance, use the GetGlobalInstance function, or the CallBuiltin wrapper over CallBuiltinEx.

Quick Access

Documentation

Writeups

Clone this wiki locally