Hi there guys. Just a quick question.
If I do this:
table = {"LOLO",5} table = {7}
Then would the first line be erased/replaced? In other words, what would table
be if I was to print it?
The entire table would be replaced with the new list you provided.
If you want to change values in the tables instead of the whole table, you would use the indexes.
Example:
-- Indexes: [1] [2] [3] local table = {"One", "Two", "Three"} print (table[1]) -- Would print "One" table[1] = 1 --Change the first index to '1' print (table[1]) --Would print '1'
You can also manipulate to a table using table.insert()
and table.remove()
Example:
local list = {"I", "Like", "Pie"} --Notice the name is "list" table.insert(list, "a lot")--Add a new value to the end of the list for x = 1, #list, 1 do print (list[x].." ") --Will print "I like Pie a lot" end table.remove(list, 4) --Remove what is placed in index '4' for x = 1, #list, 1 do print (list[x].." ")--Will only print "I like Pie" end
Let me know if you have any other questions!
More info on tables: http://wiki.roblox.com/index.php?title=Table
the second line would overwrite the first one.
table = {"LOLO",5} table = {7} print(table[1]) --prints 7