Module vlib.helpers.vVector
execute a test function on each item
Functions
sort (t, fn_compare) | sort elements according to the specified function |
merge (t1, t2) | merge two vectors, using the specified key to identify matching items note: t1 overwrites matches in t2 this method is used when working on a temporary/filtered set of items, and then joining it with the original |
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 refactor into vVectorSelectable |
get_selected_item (t) | return first item whose "checked" attribute is true TODO refactor into vVectorSelectable |
Functions
- sort (t, fn_compare)
-
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
note: t1 overwrites matches in t2
this method is used when working on a temporary/filtered set of items,
and then joining it with the original
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
- count_checked (t)
-
count checked items ("checked" is key, value is boolean)
TODO refactor into vVectorSelectable
Parameters:
- t (table)
Returns:
-
int
- get_selected_item (t)
-
return first item whose "checked" attribute is true
TODO refactor into vVectorSelectable
Parameters:
- t (table)
Returns:
-
table