Saving a list variable. in Developer Help
|
|
Description:
I have a var which is a list. When saving the list everything seems to run smoothly. When loading it won't load the var. It was saved under a proc.
For e.x:
mob var list Example_List = list()
mob proc Save_File() var/savefile/save = new("Savefile/[src.key]/Savefile.sav") save["x"] << src.x save["y"] << src.y save["z"] << src.z save["Example List"] << src.Example_List Load_File() var/savefile/load = new("Savefile/[src.key]/Savefile.sav") load["x"] >> src.x load["y"] >> src.y load["z"] >> src.z load["Example List"] >> src.Example_List
|
Extra:
When loading a file with the example list the x/y/z vars don't work. Is there a specific way to save lists?
|
anything not under the /tmp directive will be saved if you did a push (ie: save << src)
so you don't have to manually go through everything the mob owns and specifically push it to save it
so if Example_List was of /tmp (ie: mob/var/list/tmp/Example_List) then yes, you'd have to specifically do save << src.Example_List
things like x, y, and z are always tmp variables, so they don't get saved automatically.
another thing that is happening automatically is by defining your variable with = list() at the end, means its being filled with null at run time. this may or may not be happening before or after you are using Load_File() procedure.
you also may not be calling src.Load_File() on the correct "/mob" at the right time...