Tables are a very important part of some games. I sometimes even add players to tables! But there is a problem with that. I cant remove the layer from the table. Whenever I print the table, the data looks like:
table: 0x1a7105ac1e83c069
and I don't know how to remove that! I used player, player.Name, player.UserId, everything! please help me, and I would appreciate that!
There's two ways of doing this, one way consists of multi-line printing
1 | local table 1 = { "Jerry" , "Squidward" , "Spongebob" } |
2 |
3 | for _,v in pairs (table 1 ) do |
4 | print (v) |
5 | end |
Here's another way, with one line printing
1 | local table 2 = { "Sandy" , "Mr Krabs" , "Plankton" } |
2 |
3 | print ( unpack (table 2 )); |
To remove you'd do
1 | local table = { "one" , "two" , "three" , "four" , "five" } |
2 |
3 | table.remove(table, 3 ) -- Would remove the 3rd argument which is "three" |