A table has lots of uses, and with lots I mean a real lot. A cool technical note is that the only data type in Lua actually is a table. Numbers and strings are actually tables, yet you can just use them like they were numbers and strings.
Tables can be used when:
- You want to use the same action on some variables
- You want to store variables
- You want to make a handy way to store data
A normal variable is normally a "number" (such as 6 or 3.1) or a "string" (such as "Hello!" and "ugh"). A table is a list. You create tables either list-style or record-style:
2 | Seasons = { "Winter" , "Spring" , "Summer" , "Autumn" } |
5 | Banned = { jobro 13 = true , ConnorVIII = false } , |
6 | GiveSword = { ConnorVIII = true } |
As you can see you can also put tables inside tables!
To get a field from a table use .
for "keys" (the place in the table where they are stored at) which dont have spaces or special characters or []
for keys which have spaces or special characters.
In fact, "game" is also a "table-like" object. If you use the type function on it, it will return "userdata". Roblox (and actually, Lua) uses C as backend language - it's programmed in there. Lua basically runs in C. Userdata is data from C, but which we can edit from Lua. This is quite special.
6 | jobro 13 Banned = PlayerList.Banned.jobro 13 |
8 | jobro 13 Banned = PlayerList [ "Banned" ] [ "jobro13" ] |
Locked by adark and Articulating
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?