blob: 5423f1cc9255200ec8050330c1279a06a95975e7 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra715ec202025-07-09 22:18:31 +02002 mapping mkmapping(mixed *arr1, mixed *arr2,...)
Zesstrad59c3892019-11-28 20:53:39 +01003 mapping mkmapping(struct st)
MG Mud User88f12472016-06-24 23:31:02 +02004
Zesstra715ec202025-07-09 22:18:31 +02005DESCRIPTION
6 The first form returns a mapping with indices from 'arr1' and
7 values from 'arr2'... . arr1[0] will index arr2...[0], arr1[1]
8 will index arr2...[1], etc. If the arrays are of unequal size,
9 the mapping will only contain as much elements as are in the
10 smallest array.
MG Mud User88f12472016-06-24 23:31:02 +020011
Zesstra715ec202025-07-09 22:18:31 +020012 The second form converts the given struct <st> into a mapping
13 using the struct member names as index values.
MG Mud User88f12472016-06-24 23:31:02 +020014
Zesstra715ec202025-07-09 22:18:31 +020015EXAMPLES
Zesstrad59c3892019-11-28 20:53:39 +010016 mkmapping( ({ 1, 2 }), ({ 10, 11 }), ({ 20, 21, 22}))
Zesstra715ec202025-07-09 22:18:31 +020017 returns ([ 1:10;20, 2:11;21 ])
MG Mud User88f12472016-06-24 23:31:02 +020018
Zesstrad59c3892019-11-28 20:53:39 +010019 struct s { int a; int *b; int c; };
20 mkmapping( (<s> a: 1, b: ({ 2, 3 }), c: 3 )
Zesstra715ec202025-07-09 22:18:31 +020021 returns ([ "a":1, "b":({2,3}), "c":3 ])
MG Mud User88f12472016-06-24 23:31:02 +020022
Zesstra715ec202025-07-09 22:18:31 +020023HISTORY
24 LDMud 3.3.433 added the conversion from structs.
MG Mud User88f12472016-06-24 23:31:02 +020025
Zesstra715ec202025-07-09 22:18:31 +020026SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020027 mappings(LPC), mappingp(E), m_indices(E), m_values(E),
28 m_add(E), m_delete(E), sizeof(E), widthof(E), unmkmapping(E),
29 to_struct(E)