MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 01c0287 | 2019-03-01 21:51:21 +0100 | [diff] [blame] | 2 | int sizeof(mixed * val) |
| 3 | int sizeof(string val) |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 4 | int sizeof(bytes val) |
Zesstra | 01c0287 | 2019-03-01 21:51:21 +0100 | [diff] [blame] | 5 | int sizeof(mapping val) |
| 6 | int sizeof(struct xxx val) |
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 | Returns the number of elements of an array or struct, the number of |
| 10 | characters in a string, number of bytes in a byte sequence, or the |
| 11 | number of keys in a mapping. |
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 | As a special case, the number 0 can be passed, and the function |
| 14 | will return 0. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 15 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 16 | If there were any objects destroyed in the game since the mapping was |
| 17 | last checked for destructed keys, the mapping() needs to be checked |
| 18 | for destructed objects in keys first. In that case, the runtime |
| 19 | increases linear with the number of keys in the mapping (O(n)). |
| 20 | Otherwise the runtime is independent of the mappings size (O(1)). |
Zesstra | 01c0287 | 2019-03-01 21:51:21 +0100 | [diff] [blame] | 21 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 22 | HISTORY |
| 23 | LDMud 3.2.9 added strings to the possible parameters. |
| 24 | LDMud 3.3 added support for structs. |
Zesstra | 01c0287 | 2019-03-01 21:51:21 +0100 | [diff] [blame] | 25 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 26 | SEE ALSO |
Zesstra | 01c0287 | 2019-03-01 21:51:21 +0100 | [diff] [blame] | 27 | strlen(E), allocate(E), pointerp(E), mappingp(E), m_allocate(E), |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 28 | widthof(E), text_width(E) |