MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 2 | string save_value(mixed value) |
| 3 | string save_value(mixed value, int format) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 5 | DESCRIPTION |
| 6 | Encode the <value> into a string suitable for restoration with |
| 7 | restore_value() and return it. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 8 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 9 | The optional <format> argument determines the format of the savefile |
| 10 | to be written: |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 11 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 12 | -1: use the driver's native format (default). |
| 13 | 0: original format, used by Amylaar LPMud and LDMud <= 3.2.8 . |
| 14 | 1: LDMud >= 3.2.9: no-lambda closures, symbols, quoted arrays |
| 15 | can be saved. |
| 16 | 2: LDMUd >= 3.5.0: floats are stored in a different way, which is |
| 17 | more compact and can store the new floats losslessly. |
| 18 | |
| 19 | It is recommended to use version 2 or higher. |
| 20 | |
| 21 | The created string consists of two lines, each terminated with |
| 22 | a newline character: the first line describes the format used to |
| 23 | save the value in the '#x:y' notation; the second line is the |
| 24 | representation of the value itself. |
| 25 | |
| 26 | The format of the encoded value and of the format line matches |
| 27 | the format used by save_object() and restore_object(). |
| 28 | |
| 29 | HISTORY |
| 30 | Introduced in LDMud 3.2.8. |
| 31 | LDMud 3.2.9 added the saving of non-lambda closures, symbols, |
| 32 | and quoted arrays, using the new savefile format version 1. |
| 33 | LDMud 3.2.10 added the <format> argument. |
| 34 | LDMud 3.5.0 added savefile format version 2. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 35 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 36 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 37 | restore_value(E), restore_object(E), save_object(E) |