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

Cookie system/ Read file (need help)

Started by gheotic, 22 January 2013 - 09:19 PM
gheotic #1
Posted 22 January 2013 - 10:19 PM
Im have made a email system that can send and receive emails
but my problem is to save them


it can only be saved on the computer atm im wondering if there is a way to save them in a file and then read the line the email is at?

because there is some problems on servers so when the server restart the programs do to and then i reload everything


any help would be appreciated =)
remiX #2
Posted 22 January 2013 - 10:47 PM
Check out the fs api on the computercraft wiki.

Then to get the email, you would have to read everyline and save it into a table. Then have the first part of the email be [email]
..Email
Here
[/emai]

So you know where the emil exaxtly is. On my phone so xan't explain much
Engineer #3
Posted 23 January 2013 - 01:00 AM
Save the message to another file temporarily
KaoS #4
Posted 23 January 2013 - 01:35 AM
firstly how are you storing the emails at the moment? do you keep one at a time, use a table or have separate variables for each email?
3ydney #5
Posted 23 January 2013 - 02:00 AM
Use the FS API. FS stands for File System. With this API you can write to a file and read a file! Its very helpful. I use it for storing information all the time!
gheotic #6
Posted 23 January 2013 - 05:27 AM
i have a few questions for that how do i tell what line i wanna write on in the file?
KaoS #7
Posted 23 January 2013 - 05:52 AM
there are better ways of storing it in a file than using line numbers. please tell us how you are storing the information so we can come up with a solution fitted to your needs