This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Mendoza's profile picture

Error with fs API

Started by Mendoza, 13 August 2014 - 11:11 AM
Mendoza #1
Posted 13 August 2014 - 01:11 PM
I´m working with the fs API to do my program´s variables persistent, but I always get an error:

a = 1
fs.open("VALUES", "w")
h.writeLine(a)
fs.close()

Here I´m storing the value for A, but the turtle says: Attempt to call an Index ? (nil value)
Bomb Bloke #2
Posted 13 August 2014 - 01:21 PM
"a" isn't the problem - "h" is the value you're attempting to index into. But you haven't defined a "h"!

Try:

a = 1
h = fs.open("VALUES", "w")
h.writeLine(a)
h.close()
Mendoza #3
Posted 13 August 2014 - 02:01 PM
"a" isn't the problem - "h" is the value you're attempting to index into. But you haven't defined a "h"!

Try:

a = 1
h = fs.open("VALUES", "w")
h.writeLine(a)
h.close()

Thanks, now I can continue doing my script
Dragon53535 #4
Posted 14 August 2014 - 05:44 PM
I work with the fs API alot in what i usually work on, (just door locks :P/>) and a tutorial i read that helped me alot with learning it is Here.