Module helpers.vVector
Static methods for tables whose elements all have the same data type
Functions
filter (t, fn_callback) | [[ TODO execute a test function on each item |
sort (t, fn_compare) | TODO sort elements according to the specified function |
merge (t1, t2) | merge two vectors, using the specified key to identify matching items used for joining a temporary/filtered set with the original note: t1 overwrites matches in t2 |
match_by_key_value (t, key, val) | Match entry in an array (provide key + value) |
count_checked (t) | count checked items ("checked" is key, value is boolean) TODO depricated, use match instead |
get_selected_item (t) | return first item whose "checked" attribute is true TODO depricated, use match instead |
Functions
- filter (t, fn_callback)
-
[[
TODO execute a test function on each item
Parameters:
- t (table)
- fn_callback (function)
Returns:
-
table
- sort (t, fn_compare)
-
TODO sort elements according to the specified function
Parameters:
- t (table)
- fn_compare (function) needs to return a boolean value
Returns:
-
table
- merge (t1, t2)
-
merge two vectors, using the specified key to identify matching items
used for joining a temporary/filtered set with the original
note: t1 overwrites matches in t2
Parameters:
- t1 (table)
- t2 (table)
Returns:
-
table
- match_by_key_value (t, key, val)
-
Match entry in an array (provide key + value)
Parameters:
- t (table)
- key (string)
- val (variant)
Returns:
- variant or nil
- int (index)
- count_checked (t)
-
count checked items ("checked" is key, value is boolean)
TODO depricated, use match instead
Parameters:
- t (table)
Returns:
-
int
- get_selected_item (t)
-
return first item whose "checked" attribute is true
TODO depricated, use match instead
Parameters:
- t (table)
Returns:
-
table