Array functions


array_key

mixed array_key(int arrayID, int index)

Don’t use it directly; it is generated by the compiler in foreach loops.


arrayexpr

int arrayexpr(mixed key, mixed value)

Don’t use it directly; it is used by compiler to create array expressions.


create_array

int create_array(int size, int nothing)

Creates permanent array (but not “saved”).


fix_array

void fix_array(int arrayID)

Changes “temporary” array into “permanent” (“permanent” arrays are not automatically saved into savegames).


free_array

void free_array(int arrayID)

Deletes any array.


get_array

mixed get_array(int arrayID, mixed key)

Returns array value by key or index (shorthand: arrayID[key]).


len_array

int len_array(int arrayID)

Returns number of elements or key=>value pairs in a given array.


load_array

int load_array(mixed key)

Load array from savegame data by the same key provided in “save_array”.


resize_array

void resize_array(int arrayID, int size)

Changes array size.


save_array

void save_array(mixed key, int arrayID)

Array is saved (arrayID is associated with given “key”).


scan_array

mixed scan_array(int arrayID, mixed value)

Searches for a first occurence of given value inside given array.


set_array

void set_array(int arrayID, mixed key, mixed value)

Sets array value (shorthand: arrayID[key] := value).


temp_array

int temp_array(int size, int nothing)

Works exactly like “create_array”, only created array becomes “temporary.”