I’m trying to make a table/party system for my game, but I don’t know what I’m doing. I have a few questions to ask about how I can make this.
What are tables? What scripts can access them?
How can I create/destroy a table?
For my game, I want the player to press a GUI button that adds them to the table, how can I add them to the table? / How can I remove players from the table?
How can I create a GUI that lists all the players inside the table?
the thing that is being stored is called a value
the thing that locates where the value is is called a key
keys can be numbers or strings (words)
the values can be any data type
and you make tables with {}
--keys are numbers
local testTable = {
[1] = "a",
[2] = 9999,
}
--this is the same as
local testTable = {"a","b"} -- order in the table implies number keys
print(testTable[1]) -- "a"
--string keys
local testTable2 = {
["asdf"] = "12345",
["test"] = 12312313,
}
print(testTable["test"]) -- 12312313
use the table library to insert and delete from tables
if you use the table library then your tables must have number keys