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 to_string(mixed) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 4 | (string)<value> |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 5 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 6 | DESCRIPTION |
| 7 | The argument is converted to a string. Works with int, float, |
| 8 | object, arrays, structs, symbols, strings and closures. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 10 | Converts closures and structs into an appropriate name (this |
| 11 | has mostly debugging purposes). |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 12 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 13 | CAVEAT: Arrays are considered exploded strings, ie. arrays of |
| 14 | Unicode codepoints (i.e. each number is one Unicode character), |
| 15 | and are 'imploded' up to the first non-number entry, whatever |
| 16 | comes first. That means that to_string(({ 49, 50 })) will return |
| 17 | "12" and not "({ 49, 50 })". |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 18 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 19 | BUGS |
| 20 | The cast notation only works if the precise type of <value> |
| 21 | is known at compile-time. This will not be fixed - use the |
| 22 | function form instead. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 23 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 24 | HISTORY |
| 25 | LDMud 3.2.8 adds lambda closures to the accepted data types. |
| 26 | LDMud 3.3.250 adds structs to the accepted data types. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 27 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 28 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 29 | to_array(E), to_int(E), to_object(E), to_struct(E), sprintf(E) |