MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | object to_object(string arg) |
| 3 | object to_object(closure arg) |
| 4 | object to_object(object arg) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 5 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 6 | (object)<value> |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 7 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 8 | DESCRIPTION |
| 9 | The argument is converted into an object, if possible. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 10 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 11 | For strings, the object with a matching object_name() is |
| 12 | returned, or 0 if there is none, as find_object() does. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 13 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 14 | For (bound!) closures, the object holding the closure is |
| 15 | returned (for 'alien lfun closures' this is the object which |
| 16 | created the closure, not the object the lfun is defined in). |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 17 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 18 | Objects and the number 0 return themselves. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 20 | BUGS |
| 21 | The cast notation only works if the precise type of <value> |
| 22 | is known at compile-time. This will not be fixed - use the |
| 23 | function form instead. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 24 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 25 | SEE ALSO |
| 26 | find_object(E), to_array(E), to_int(E), to_string(E), |
| 27 | get_type_info(E) |