ID:176529
 
Ok here it is. I am trying to save tha contents of a list onto the text file. I am saving each one seperately. like so:
mob/proc/write()
var/savefile/F = new()
var/txtfile = file("config/config.cfg")
for(var/X in functions)
F["[X]"] << X
fdel(txtfile)
F.ExportText("/",txtfile)


now im wondering how i can load these back onto the list. is there a way to loop through every single thing in the file and add it to the functions list?
Weedman wrote:
Ok here it is. I am trying to save tha contents of a list onto the text file. I am saving each one seperately. like so:
mob/proc/write()
var/savefile/F = new()
var/txtfile = file("config/config.cfg")
for(var/X in functions)
F["[X]"] << X
fdel(txtfile)
F.ExportText("/",txtfile)
now im wondering how i can load these back onto the list. is there a way to loop through every single thing in the file and add it to the functions list?

Indeed there is. Except I'd change the save line, because it looks like you're associating a value when you don't need to:
for(var/X in functions)
F << X

Now then:
mob/proc/read()
var/savefile/F = new()
var/txtfile = file("config/config.cfg")
F.ImportText("/",txtfile)
functions = list()
for(var/X in F.dir)
functions += X

Lummox JR
In response to Lummox JR
Thank you again Lummox