33 posts
Posted 29 November 2012 - 01:30 PM
Whenever I print a table it comes up with table:something. How do I turn the table into text or a string?
1688 posts
Location
'MURICA
Posted 29 November 2012 - 01:34 PM
If you want to print what's in a table, you have to either go through it with a loop,
for i=1, #someTable do
print(someTable[i])
end
or just use table.concat().
print(table.concat(someTable,', ')) -- prints every part of the table with a comma in between each of them
1619 posts
Posted 29 November 2012 - 01:51 PM
textutils.serialize(table)
1054 posts
Posted 29 November 2012 - 02:39 PM
It the table contains strings and numbers, then Kingdaro's suggestion:
print(table.concat(someTable,',\n'))
and
textutils.tabulate(someTable)
Might be the quickest and cleanest ways to print it readable.
2005 posts
Posted 30 November 2012 - 10:01 AM
textutils.serialize is mainly intended for when you need to store/transmit a table (in a file or over rednet), but it can also be useful if you just want the maximum specificity on the layout of the table.