Arrays
Arrays are quite simple.
An array represents a contiguous list of values in a table. I.e., { "a", "b", "c" }
An array shouldn't have any nil
s or "gaps". If you want holes in a table, use Maps.
You can define a valid array Datatype using a simple table, just like luau:
Using the above table syntax will behave the same as passing the table into the API shown below.
function light.datatypes.arr
First argument should be any Datatype which cannot be nil
. The length
parameter describes the number of items in the array, and will default to
datatypes.u16
.
The length datatype should NOT be a regular number—instead: use a
datatype that represents a number, like a uint
, or a
range
.
A couple of ways you could use the optional length
parameter: