Datatypes
What is a Datatype?
A datatype is something that represents a set of possible values. When you're sending something across the network with light, you'll need to define what you want that thing to look like. Light has a lot of tools for doing just that, but here's an example of one of the primitive number Datatypes:
The prefix u
indicates the number should be an "unsigned integer"; a whole number greater than zero. The number to the right, 8
, is the number
of "bits"1 the value will take up across the network. A u8 represents a value 0
and 255
Lying to luau
Generally, places where you see Datatype<T>
in these docs, you will only see T
or a type in your
editor. Generally, this avoids causing problems with Luau's type system.
-
8 bits is also known as a byte.
&local bytes = bits // 8
↩local bits = 8·bytes