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

line in file:lines()

Started by DiabolusNeil, 07 December 2013 - 06:21 PM
DiabolusNeil #1
Posted 07 December 2013 - 07:21 PM
Okay. I made a program in 1.5.2 of Minecraft that used
for line in file:lines() do -- file was already declared
and it worked perfectly. Now I'm trying to get that to work in 1.6.4 using CC1.57, and I get the same error everytime:
attempt to call nil
What am I doing wrong?

EDIT: I found the problem. Apparently the lines() function is removed from the FS API. I have to use IO instead.
Edited on 07 December 2013 - 06:29 PM
Lyqyd #2
Posted 07 December 2013 - 07:22 PM
Please post the whole code.
Bomb Bloke #3
Posted 07 December 2013 - 07:33 PM
Note that ":lines()" is only available to files opened with io.open(), as opposed to fs.open().

Edit: Aaand then his edit comes through.
Edited on 07 December 2013 - 06:33 PM