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.
storing code in a file
Started by hugeblank, Nov 29 2015 05:57 AM
3 replies to this topic
#1
Posted 29 November 2015 - 05:57 AM
#2
Posted 29 November 2015 - 06:03 AM
Put quotes around what you are trying to write to the file:
Also you might have already done this, but don't forgot to close 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.
#3
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?
1. What if you have something like this:
file.writeLine("if peripheral.get Type == "modem" then")
Wouldn't it turn "modem" into a variable?
#4
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")
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











