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

[Question]How do you have a long code in an a string

Started by whatsfast, 26 November 2012 - 04:29 AM
whatsfast #1
Posted 26 November 2012 - 05:29 AM
I want to put a program in a string. How would I do that. The programs 40 lines long.
Kingdaro #2
Posted 26 November 2012 - 06:43 AM
You can use the fs API to read files.


local programname = 'your_program_name'
local content

local file = fs.open(programname)
if file then
  content = fs.readAll()
  file.close()
end
In this example, the program is stored in the variable content.
whatsfast #3
Posted 26 November 2012 - 07:26 AM
The program will be a client api. Can the other person on a server access my files. Anyway is it possible to put multiple lines in a string. I would like to have a program server maybe.
whatsfast #4
Posted 26 November 2012 - 07:30 AM
I figured out the multi line integar but my other question still remains. Can other people save or edit files on my computer or only on theirs?
Kingdaro #5
Posted 26 November 2012 - 07:34 AM
I figured out the multi line integar but my other question still remains. Can other people save or edit files on my computer or only on theirs?
They can easily save and edit files on your computer, but only while ON your computer. They can't do it from their own computer; you would need to set up sort of an FTP server to do that. There are plenty of FTP programs on the forums, if you search around a bit.