|
LPC Library Functions: allocate_mapping |
|
NAMEallocate_mapping() - pre-allocate space for a mapping
SYNOPSISmapping allocate_mapping( int size ); mapping allocate_mapping( mixed *keys, mixed v );
DESCRIPTIONIn the first form, returns a mapping with space for 'size' elements preallocated. For example:
mapping x;
int y = 200;
x = allocate_mapping(y);
In this example, y is the initial size of the mapping. For efficiency of storage, using allocate_mapping is the preferred way to initalize the mapping if you have some idea of how many elements the map will contain. Note that doing so does not restrict you to a fixed number of elements. If you will be deleting many elements from the mapping, you should use x = ([]) to initialize the mapping rather than using allocate_mapping(). In the second form of allocate_mapping(), 'keys' will be the initial keys of the mapping and 'v' will be used to initialize the values of the mapping.
SEE ALSO |
|
Page design by Frank Jacquette & Tim Hollebeek Copyright (C) 1998 Tim Hollebeek & Frank Jacquette |
|