Data Types
TuffSeal is dynamically typed.
Primitive Types
let n = 42; // integer / number
let s = "hi!"; // string
Arrays
let arr = [1, 2, 3, "four"];
print(arr[0]);
NOTE: Array indexing starts at 0.
arr[0] would return "1" because the object with the index 0 inside the array is the number one.
Dictionaries
let dict = {
a: "Hello!",
b: 5
}
print(dict.a);
print(dict["b"]);
type() Builtin
TuffSeal provides a builtin function for detecting what type is a specific variable.
let arr = [1, 2, 3]; // array
print(type(arr)); // "array"
//--------------------------//
let dict = {
a: 5,
b: 10
}
print(type(dict)); // "dictionary"
Possible Values
- "fn" (functions)
- "int" (numbers / integers)
- "str" (strings)
- "bool" (booleans)
- "array" (arrays)
- "dictionary" (dictionaries)
- "luau_external" (other)
NOTE: If a variable has a type that doesn't exist inside of TuffSeal, but exists in Luau, it will return luau_external