The "ds_struct_set" Function
#
SyntaxArgument | Type | Description |
---|---|---|
id | struct | The struct to modify |
key | string | The key to assign a value to |
value | any | The value (number, string, array, struct, data structure, etc.) to assign |
#
DescriptionAssigns a value to the specified key within the given struct. The struct must have been previously created (e.g. with ds_struct_create
).
If multiple levels of struct exist, it is possible for the same key to occur multiple times with different values. To increase the speed and precision of this function, you can specify which level to search by prepending the key with any parent structs separated by a period. In this case, the first parent specified must exist in the root struct, but deeper levels will be recursed and are optional, provided the key already exists. If the key does not exist, any parents will be created as well in the order specified.
To get the value of a key once set, use ds_struct_find_value
.