-
Notifications
You must be signed in to change notification settings - Fork 0
Adding Other Types
Dickson Law edited this page Jul 4, 2020
·
1 revision
You can make a new struct type compatible with the Lightweight Data Structures ecosystem by implementing the following methods:
-
reduceToData(): Return a JSON-encodable representation of self in terms of only GML elementary types (i.e. untyped structs, arrays, real, string, boolean, undefined). -
expandFromData(data): Clear self and restore the output ofreduceToData()into self. -
copy(source): Clear self and shallow-copy from the provided source. -
copyDeep(source): Clear self and then deep-copy from the provided source. If there is no further nesting in your type, you can alias this tocopy. -
clone(source): Return a shallow clone of self. -
cloneDeep(source): Return a deep clone of self. If there is no further nesting in your type, you can alias this toclone.
Then go to __LDS_CONFIGS__ and add a function entry to global.__lds_registry__ like this that returns a new starter struct of your type:
MyNewType: function() {
return new MyNewType();
},