Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (36 sloc) 1.89 KB
int restore_object(string name)
int restore_object(string str)
Restore values of variables for current object from the file <name>,
or directly from the string <str>.
To restore directly from a string <str>, the string must begin
with the typical line "#x:y" as it is created by the save_object()
When restoring from a file, the name may end in ".c" which is stripped
off by the parser. The master object will probably append a .o to the
<name>. The validity of the filename is checked with a call to
Return 1 on success, 0 if there was nothing to restore.
Variables that has the type modifer 'nosave' will not be restored.
Example: nosave int xxx;
Lfun, variable and simul_efun closures are restored only if they
can be found (this excludes closures of private lfuns as well) - if
not, they are restored as value '0'.
If inheritance is used, then it might be possible that a
variable will exist with the same name in more than one place,
and thus appear in the save file multiple times. When
restoring, the variables are restored in the order they are
found in the inheritance tree. A good practice is to have
verbose and unique name on non-static variables, which also
will make it more easy to read or patch the save file
Restoring directly from a string was added in LDMud 3.2.8 and
may be moved in future into a separate efun.
LDMud 3.2.9 added the restoring of non-lambda closures, symbols,
and quoted arrays, using a new savefile format version.
LDMud 3.5.0 added the possibility to restore version 2 with its higher
float precision.
save_object(E), restore_value(E), valid_read(M)