Title: Help with reading tables from a file
I'm creating my own sorting system using computers and I'm having trouble with my client computer reading a table to translate from item name to item id.
This works properly in my central unit which opens the file and keeps count of the items, yet i get "serialize:1: table index expected, got nil" as an error in the client
This is the code (on both my client and CU)
local file = fs.open("nameItem","r")
local data = file.readAll()
file.close()
s = textutils.unserialize(data)
And this is the file it (the client) reads from:
{[Smoothstone]=1,[Cobblestone]=4,[StoneBricks]=98,[Obsidian]=49,[Netherrack]=87,[NetherBrick]=112,[EndStone]=121,[Sandstone]=24,[Dirt]=3,[Gravel]=13,[Sand]=12,[GrassBlock]=2,[SoulSand]=88,[Flint]=318,[IronIngot]=265,[GoldIngot]=266}
File the CU reads from (item counts), if it helps;
{[1]=0,[4]=0,[98]=0,[49]=0,[87]=0,[112]=0,[121]=0,[24]=0,[3]=0,[13]=0,[12]=0,[2]=0,[88]=0,[318]=0,[265]=0,[266]=0}
What am I doing wrong? And is there a more efficient way of doing this?











