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

Anyway to make a config file?

Started by ade125, 26 October 2014 - 01:39 PM
ade125 #1
Posted 26 October 2014 - 02:39 PM
I am trying to make something and I need a config file system.

Is there any easy way to use a file for that?
Dragon53535 #2
Posted 26 October 2014 - 03:09 PM
You can get started by looking at this easy FS tutorial. Here. And if you still have questions, i'm sure we'll be happy to help
Bomb Bloke #3
Posted 26 October 2014 - 09:40 PM
As a bit of an example, take a read through lines 1160-1204 in this script. If the game's INI file is found in the current directory, it opens it and parses the contents. If it's not, it generates a new INI file, and the default values defined up on line 32 are used instead.
ade125 #4
Posted 27 October 2014 - 09:44 AM
Wouldn't a serialized table make things easier? For the programmers at least?
Anavrins #5
Posted 27 October 2014 - 10:37 AM
Wouldn't a serialized table make things easier? For the programmers at least?
Congratulation, you've answered you own question :D/>
theoriginalbit #6
Posted 27 October 2014 - 12:18 PM
In the event that you do actually want an API which deals with configuration files for you, I have an API called ccConfig which you can find in my programs thread (link in signature), it supports the ability for you to have user configurable strings, numbers, booleans, colours, etc.
AssossaGPB #7
Posted 27 October 2014 - 04:20 PM
Yeah, you could use serialized tables pretty easily. just use textutils and fs to do it. I actaully use that method for my configs.