ID:1509523
 
(See the best response by Koshigia.)

Problem description:Hi :D how are u? Well, i tried to do this by myself but i need your help, how can i save lists? I checked other posts about this but i didn't understand them very well, so i hope that u can help me.

I can't do something like this(i'm aware of that) but i can't fix my code :


mob/var/list/TEST=list()

mob/verb/Edit_list()

var/b= input("Add to TEST")as num
TEST +=b
var/savefile/F = new("[usr.name]/savefile.sav")
Write(F)


mob
Login()
..()
var/savefile/F = new("[usr.name]/savefile.sav")
Read(F)


mob
Write(var/savefile/F)
..()
F<<src.TEST

Read(var/savefile/F)
..()
F>>src.TEST




Thanks for your attention
,MistY,
Best response
One issue you may have while testing this is that you are automatically loading a savefile when you reboot. Therefor some changes you may have had from previous testing may persist. For instance, if you had previously saved while having the TEST list uninitialized, it will remain so every time you load the uninitialized var/list/TEST from the savefile.

Other than that, you should be able to load a list just fine with your code. Use this test command to verify.

mob/verb/test()
src << "Length = [length(TEST)]"
var/text
for(var/x in TEST)
text += "[x] "
src << text
Oh :P thanks buddy.