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

How would I make a computer store info

Started by diamondpumpkin, 29 April 2015 - 05:32 PM
diamondpumpkin #1
Posted 29 April 2015 - 07:32 PM
I'm trying to make a computer program that keep tracks of numbers for a money system. I'm not even sure where to start with it or how to store data like a few numbers. Little help?
Creator #2
Posted 29 April 2015 - 08:36 PM
use fs api:


local file = fs.open(path,"w")
file.write(data)
file.close()

This simple it is.

If youre using tables, use this


data = textutils.serialize(myTable)

the table cannot contain functions or anything but strings nums and bools
diamondpumpkin #3
Posted 29 April 2015 - 08:50 PM
I am new at this I barely know what any of that means.
Creator #4
Posted 29 April 2015 - 09:08 PM
fs.open ==> open file, save handler to var file

file.write ==> this info will be written to the file

file.close ==> CLOSES & saves file
diamondpumpkin #5
Posted 29 April 2015 - 09:20 PM
Okay, thanks! I made most of my system.
Creator #6
Posted 29 April 2015 - 09:29 PM
You're welcome, and be sure to ask more questions if you need to