The "ds_struct_equals" Function
#
SyntaxArgument | Type | Description |
---|---|---|
var1 | struct | The source struct to be compared |
var2 | struct | The target struct to compare with |
#
DescriptionCompares the contents of two structs and returns true
or false
depending on whether the contents and their values are equal. This script will function recursively, also comparing any structs and arrays within the root struct.
Note that volatile data structure and method contents cannot be compared due to GameMaker's handling of references for these types, and as such may behave differently than expected:
- Data structures will be compared by reference only and thus will only return
true
if the exact same structure is referenced. Identical copies will returnfalse
because each copy has a unique (non-matching) index. - Methods cannot be compared by contents or reference and therefore will always return
true
provided a method exists at the same location in each struct.