#MyTables[1] ? Huuuuh ?
1 messages · Page 1 of 1 (latest)
the lua documentation has some pretty good insight on tables.
Although my go-to similarity in tables is that I like to call them a bank.
The table is the bank, the index is the key. You can have numerous keys, but each key has one specific access inside of the bank
local foo = {
red = 50, blue = 30, yellow = 10
}
print(foo[red])```
the red key gets the value of 50
So scripting is a string, yes.
its a variable that holds a string
you assign a key to landlesstable with that variable
so when you slot the key into LandlessTable, you get "Welp" since you assigned that value there.
By default, without assigning an index, variables start from 1
So if you make a table like so:
local table1 = {1, 5, 10, 15, 20}
table1[1] = 1
table1[2] = 5
table1[3] = 10
table1[4] = 15
and so on
However, you can also assign the index too
local table1 = {food1 = 5, food2 = 10, food3 = 15}
table1[food1] is 5
So if you had a hunger mechanic in your game and you ate food, youd call on a table like so in order to see how much to replenish your hunger bar for