blob: 89b9bd698c1169783e82b6adce9bceb0f7b24810 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra715ec202025-07-09 22:18:31 +02002 int reverse(int arg)
3 string reverse(string arg)
4 bytes reverse(bytes arg)
5 mixed * reverse(mixed * arg)
6 mixed * reverse(mixed * & arg)
MG Mud User88f12472016-06-24 23:31:02 +02007
Zesstra715ec202025-07-09 22:18:31 +02008DESCRIPTION
9 Reverse the content of array, string or byte sequence <arg> and
10 return the result. If <arg> is an integer, the bits in the
11 integer are reversed.
MG Mud User88f12472016-06-24 23:31:02 +020012
Zesstra715ec202025-07-09 22:18:31 +020013 If called in the reference variant, the argument array itself
14 is reversed and then returned.
MG Mud User88f12472016-06-24 23:31:02 +020015
Zesstra715ec202025-07-09 22:18:31 +020016EXAMPLES
17 reverse(0x306a) - returns 0x560c0000
MG Mud User88f12472016-06-24 23:31:02 +020018
Zesstra715ec202025-07-09 22:18:31 +020019 reverse("test") - returns "tset"
MG Mud User88f12472016-06-24 23:31:02 +020020
Zesstra715ec202025-07-09 22:18:31 +020021 mixed * arr = ({ 1, 2 });
22 reverse(arr) - returns ({ 2, 1 }), leaves arr unchanged.
23 reverse(&arr) - returns ({ 2, 1 }), sets arr to ({ 2, 1 })
MG Mud User88f12472016-06-24 23:31:02 +020024
Zesstra715ec202025-07-09 22:18:31 +020025BUGS
26 Reference ranges like reverse(&(a[1..2])) are not supported.
MG Mud User88f12472016-06-24 23:31:02 +020027
Zesstra715ec202025-07-09 22:18:31 +020028HISTORY
29 Introduced in LDMud 3.3.529.
30 LDMud 3.3.532 added the reversal of bits in an integer.
MG Mud User88f12472016-06-24 23:31:02 +020031
Zesstra715ec202025-07-09 22:18:31 +020032SEE ALSO