Referencing custom struct types: Difference between revisions

Jump to navigation Jump to search
(Created page with "One of the major caveats of scripting in AGS is the lack of a way to reference custom {{link|Script language keywords|struct}} types. This hopefully will be changed in a futur...")
 
mNo edit summary
Line 76: Line 76:
We'll handle resizing the cache later, and we'll initialize the dynamic arrays when the first item is assigned. Since we are using dynamic arrays, this prevents us from using a struct for our internal cache. This is the reason why it may be easier to use a statically-sized cache if you have array members.
We'll handle resizing the cache later, and we'll initialize the dynamic arrays when the first item is assigned. Since we are using dynamic arrays, this prevents us from using a struct for our internal cache. This is the reason why it may be easier to use a statically-sized cache if you have array members.


=====Cache utility functions====
=====Cache utility functions=====
Since we are using dynamic arrays and there's no built-in mechanic for resizing them, we'll need a couple of utility functions for our cache. Note that if you are defining several types, these utility functions are generic. It is recommended to put these functions in a separate script from the rest of the struct code.
Since we are using dynamic arrays and there's no built-in mechanic for resizing them, we'll need a couple of utility functions for our cache. Note that if you are defining several types, these utility functions are generic. It is recommended to put these functions in a separate script from the rest of the struct code.