mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Expanded create/temp_array functions to allow creating a new "lookup" type of associative array (from Mr.Stalin)
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
/*
|
||||
Generic array functions
|
||||
*/
|
||||
// returns True if the specified key exists in the associative array
|
||||
procedure map_contains_key(variable arrayMap, variable key);
|
||||
|
||||
// push new item at the end of array, returns array
|
||||
procedure array_push(variable array, variable item);
|
||||
|
||||
@@ -151,6 +154,14 @@ procedure load_collection(variable name);
|
||||
|
||||
#define ARRAY_SET_BLOCK_SIZE (10)
|
||||
|
||||
procedure map_contains_key(variable arrayMap, variable key) begin
|
||||
variable i;
|
||||
for (i := 0; i < len_array(arrayMap); i++) begin
|
||||
if (array_key(arrayMap, i) == key) then return true;
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
/**
|
||||
* Returns first index of zero value
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user