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

Files and Commands

Started by cotec, 27 May 2012 - 09:25 AM
cotec #1
Posted 27 May 2012 - 11:25 AM
Hi,

I'm new to Lua so i need some help:

- Is it possible to create/read/write files?
- where can i get a list of all commands for computercraft?

Thanks!
Lolgast #2
Posted 27 May 2012 - 12:06 PM
Type help into you minecraft computer. Most information is there.
cotec #3
Posted 27 May 2012 - 12:12 PM
Okay, thanks. I didn't find anything about creating a file .. is this possible?
Lolgast #4
Posted 27 May 2012 - 12:13 PM
Do you mean making a program, or do you already have a program and want to make that program write another program?
cotec #5
Posted 27 May 2012 - 12:24 PM
no, i want to save some data, because when i save something in a variable and then reboot the computer its gone.
Lolgast #6
Posted 27 May 2012 - 12:31 PM
You'll have to write it in a program, as far as I know.
cotec #7
Posted 27 May 2012 - 12:42 PM
Ok.
Do you know how to edit the startup file? everytime i get "acess denied"
Pinkishu #8
Posted 27 May 2012 - 01:03 PM
You don't edit the startup file in the rom, you just make you own in the base folder
cotec #9
Posted 27 May 2012 - 01:16 PM
oh :)/>/>
thanks a lot
MysticT #10
Posted 27 May 2012 - 03:27 PM
To create files just open them in write mode:

local file = fs.open("path", "w")
It would create the file if it doesn't exist or delete it's contents and open it.