Same as original, but you can provide the default value if the variable isn't in the instance.
NTGML API: Structs
Did you know? struct_, variable_struct_, and variable_instance_ functions in GameMaker
are all the same thing.
One exception here:
And these are original shorthand functions from before GameMaker had any reflection:
Like struct_get, but returns undefined if value is not a struct.
Like above, but with default value if the variable is missing.
Equivalent to struct_set.
Equivalent to struct_exists.
Equivalent to struct_delete.
Equivalent to array_length if argument is an array (backwards compatibility),
otherwise equivalent to struct_names_count.
Returns n-th field from a struct.
This used to not allocate anything, but now it's just a wrapper for
variable_struct_get_names (that'll get new fields when a struct changes).
Returns n-th value from a struct.
Pair of above.
Makes a shallow copy of the given struct.
var orig = { a: 4, b: "?" }; var copy = lq_clone(orig); copy.a += 4; trace(orig); // { a: 4, b: "?" } trace(copy); // { a: 8, b: "?" }