Skip to content

Legacy: CallBuiltin routine

Archie_UwU edited this page Nov 19, 2023 · 1 revision

You are reading the documentation of YYToolkit Legacy (v2.x.x) - for documentation on current-gen YYTK, see the Homepage.


Calls a built-in GML function with custom arguments and instances. Functionally the same as doing my_function(my_argument) in GML.

Syntax

bool CallBuiltin(
    YYRValue& Result, // The variable that receives the return value (result) of the called function
    const std::string& Name // The name of the function (ex. "room_goto", "array_get")
    CInstance* Self, // The instance referred to by the "self" keyword in GML
    CInstance* Other, // The instance referred to by the "other" keyword in GML
    const std::vector<YYRValue>& Args // The arguments for the function
);

Parameters

Result

A reference to a YYRValue that gets set to the called function's return value.

In GML, this is the same as:

var Result = my_function(Args)

Name

The name of the built-in function to call. These are the same as the function names used in GameMaker Language, and are case-insensitive.

Thus, room_goto is the same as RoOm_GoTo, and both will call the same function.

Self

The instance that is referred to by the self keyword in GML.

Other

The instance that is referred to by the other keyword in GML.

Args

The arguments to the function, stored in a vector of YYRValues.

You may instantiate this vector inside the arguments, for example:

CallBuiltin(Result, Name, Self, Other, { 1337.0, "Example String", true });

Return Value

The function returns true if the call succeeded. Otherwise, the function returns false.

Remarks

If both Self and Other are nullptr, the function uses the global instance as both Self and Other.

Quick Access

Documentation

Writeups

Clone this wiki locally