my code is here: http://pastebin.com/c4rHJsFK
the data in the file is:
{[1]=22256,[2]=262,[3]=332,}
{[1]=813,[2]=22256,[3]=22303,}
Edited by panicmore, 13 June 2014 - 10:29 AM.
Posted 13 June 2014 - 10:27 AM
{[1]=22256,[2]=262,[3]=332,}
{[1]=813,[2]=22256,[3]=22303,}
Edited by panicmore, 13 June 2014 - 10:29 AM.
Posted 13 June 2014 - 10:34 AM
Posted 13 June 2014 - 10:37 AM
local tables = {} -- Stores all the tables
local handle = fs.open("recipes", "r")
while true do
local text = handle.readLine()
if text then
local recipe = textutils.unserialize(text)
if recipe then
table.insert(tables, recipe) -- tables:insert won't work 1.63
end
else
break
end
end
handle.close()
Posted 13 June 2014 - 10:44 AM
natedogith1, on 13 June 2014 - 10:34 AM, said:
Ajt86, on 13 June 2014 - 10:37 AM, said:
local tables = {} -- Stores all the tables
local handle = fs.open("recipes", "r")
while true do
local text = handle.readLine()
if text then
local recipe = textutils.unserialize(text)
if recipe then
table.insert(tables, recipe) -- tables:insert won't work 1.63
end
else
break
end
end
handle.close()
Posted 13 June 2014 - 10:48 AM
panicmore, on 13 June 2014 - 10:44 AM, said:
{{[1]=22256,[2]=262,[3]=332,},
{[1]=813,[2]=22256,[3]=22303,}}
Posted 13 June 2014 - 10:51 AM
local recipes = {}
local h = fs.open("recipes.txt", 'r')
for line in h.readLine do
table.insert(recipes, line)
end
h.close()
Ajt86, on 13 June 2014 - 10:37 AM, said:
Posted 13 June 2014 - 03:26 PM
panicmore, on 13 June 2014 - 03:03 PM, said:
local tbl = {}
function tbl.insert( self, value )
return table.insert( self, textutils.unserialize( value ) )
end
tbl:insert( "hello" )
Edited by theoriginalbit, 13 June 2014 - 04:20 PM.
added textutils.unserialize
Posted 13 June 2014 - 03:40 PM
theoriginalbit, on 13 June 2014 - 10:51 AM, said:
local recipes = {}
local h = fs.open("recipes.txt", 'r')
for line in h.readLine do
table.insert(recipes, line)
end
h.close()
Edited by tomass1996, 13 June 2014 - 03:40 PM.
0 members, 2 guests, 0 anonymous users