Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 1 | SYNOPSIS |
| 2 | string object_name() |
| 3 | string object_name(object ob) |
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 | Get the name of an object <ob> or, if no argument is given, of |
| 7 | the current object. |
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 | As a special case, if <ob> is 0, the function returns 0. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 11 | This name is the name under which the object is stored in the |
| 12 | muds object table. It is initialised at the creation of the |
| 13 | object such that blueprints are named after the file they are |
| 14 | compiled from (without the trailing '.c'), and clones receive |
| 15 | the name of their blueprint, extended by '#' followed by |
| 16 | a unique non-negative number. These rules also apply to |
| 17 | virtual objects - the real name/type of virtual objects |
| 18 | is ignored. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 19 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 20 | The name of an object can be changed with rename_object(), and |
| 21 | object_name() will reflect any of these changes. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 22 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 23 | The returned name always begins with '/' (absolute path), |
| 24 | except when the parser runs in COMPAT mode. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 26 | EXAMPLES |
| 27 | find_object(object_name(ob)) == ob |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 28 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 29 | This is guaranteed to be true for all objects ob that are not |
| 30 | destructed. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 31 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 32 | HISTORY |
| 33 | 0 is accepted as argument since 3.2.9. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 34 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 35 | SEE ALSO |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 36 | clone_object(E), load_name(E), load_object(E), find_object(E), |
| 37 | object_time(E), program_name(E), rename_object(E) |