149 posts
Location
A grocery store near you!
Posted 29 November 2015 - 05:57 AM
You probably get this question a million times, but how does one store lines of code in a file?
I have this:
file.writeLine(for I, side in ipairs(rs.getsides()) do)
and it gives me an error. I already have a line above that that opens the file, so it's not that.
1023 posts
Posted 29 November 2015 - 06:03 AM
Put quotes around what you are trying to write to the file:
file.writeLine("for I, side in ipairs(rs.getsides()) do")
Also you might have already done this, but don't forgot to close the file. :P/>
149 posts
Location
A grocery store near you!
Posted 29 November 2015 - 06:20 AM
I did. Thank you! One question,
1. What if you have something like this:
file.writeLine("if peripheral.get Type == "modem" then")
Wouldn't it turn "modem" into a variable?
7083 posts
Location
Tasmania (AU)
Posted 29 November 2015 - 07:08 AM
Using the \
escape character to specify that we want certain quotes to be part of the string, we can do this:
file.writeLine("if peripheral.get Type == \"modem\" then")