What It Is
{} Curly brackets (some people refer to as “curly braces”). They are used for something in Lua called “tables”. These store multiple pieces of information about anything really. Such information can range from a simple string to an entire function. To separate this information, you must use commas.
For example, this is a table:
local Table = {"info1", "info2", "info3"}
--tables can also be written vertically, for the sake of readability (does nothing different)
local verticleTable = {
"info1",
"info2",
"info3"
}
If we try to print this, the output’s going to spit out a Hexademical memory address (which you don’t need to know in order to understand tables).
Something like (I am not an expert in HEX):
--FF020BA10
To extract information from a table, we need to know its position. Because “Info1” is the first piece of information, its place (or index) is 1. The index of “Info2” is 2, “Info3” is 3.
So, to actually reference and print one of these strings, you must write this:
local num1 = Table[1] --or [2] or [3] or so on...
print(num1) --output: info1
--if it was
local num2 = Table[2]
print(num2) --output: info2
If you want to index something in a table without using numbers, then you can create a dictionary. A dictionary (in Lua, at least) is a table that has its own index and values (values are what is for each index, i.e. “info1” or “info2”).
Here’s a simple dictionary (you would want this to be verticle because it’s easier to read):
local dictionary = {
"String" = "Any character that is within a single or double quotation mark like this itself.",
"Roblox" = "A massive multi-player platform off of which developers can create their own games!",
"Catalog" = "A section in Roblox where you can buy virtual items for your avatar."
}
MAKE SURE you don’t forget to use commas to separate values!
There, we have a nice dictionary. So, to print something out in this, you can simply use the string to index its value.
local defString = dictionary["String"]
print(defString)
--[[output: Any character that is within a single or double quotation mark like this itself.]]
Additionally, you can do operations with tables. You can add and remove values later on using a script. Or, you can unpack a table to spread the contents of a table out as arguments.
Unpacking in action:
local nums = {2, 3214, 34, 12}
local Max = math.max(1, unpack(nums)) --it would be math.max(1, 2, 3214, 34, 12)
print(Max) --3214
I cannot explain and show everything that you can do with tables, so for that you can visit the Developer Hub table page.
I hope that helps!