Array structs
Sometimes, you'd like to have a global array of a struct type, just to be able to have that field syntax we all like so much, it can be more complicated than it is supposed to, for example you have to manually initialize all the indexes to create the unique indexes, etc. Another issue is when you do not really want to use .allocate()
and .destroy()
you would like to have your own ways for allocation. Array structs are a small syntax enhancement that is equivalent to an array of a struct type, you would be able to use the members for each index and you will not have to worry about .create()
.
Certain issues with array structs: You cannot declare default values (they would automatically be zero, null or false depending on the type of the member) , you cannot declare onDestroy (it would be pointless), you cannot use .allocate
or .destroy
, you cannot have array members. Notice that the problem with default values and array members are likely to be fixed in a next version.
Notice that you can use operator declarations to override the get []
operator, in this case, to be able to use ids you would be able to use the typecast operator, e.g. playerdata(4)
to get the instances. If you did not understand this last paragraph, don't worry, you probably did not need to know this anyway.