Maps
Maps (a.k.a. Dictionaries) are quite simple.
A map represents a set of keys and values in a table.(1)
-
I.e., This is something you might want to represent with a map:
You can define a valid map 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.map
First two arguments should be any Datatypes which cannot be nil
. The
length
parameter should represent the number of keys in the map, 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: