Module table.extra
Table manipulation and transformation functions.
Info:
- Release: $Id: extra.lua,v 1.12 2013-10-12 01:32:56 tomas Exp $
Functions
fullconcat (tab, kvsep, pairssep, kfilter, vfilter) | Builds a list of pairs field=value, separated by commas. |
pfullconcat (tab, kvsep, pairssep, kfilter, vfilter) | Produces the same result as fullconcat, but it checks the arguments' types. |
twostr (tab, ksep, vsep, kfilter, vfilter) | Builds two lists, of keys and of values. |
Functions
- fullconcat (tab, kvsep, pairssep, kfilter, vfilter)
-
Builds a list of pairs field=value, separated by commas.
The '=' sign could be changed by the kvsep argument.
The ',' could also be changed by the pairssep argument.
Both the field and the value could be filtered by the kfilter and
vfilter respectivelly.
Parameters:
- tab Table of field=value pairs.
- kvsep String with key-value separator (default = '=').
- pairssep String with pairs separator (default = ',').
- kfilter Function to filter the keys (optional).
- vfilter Function to filter the values (optional).
Returns:
-
String with field=value pairs separated by ','.
- pfullconcat (tab, kvsep, pairssep, kfilter, vfilter)
-
Produces the same result as fullconcat, but it checks the arguments'
types.
Parameters:
- tab Table of field=value pairs.
- kvsep String with key-value separator (default = '=').
- pairssep String with pairs separator (default = ',').
- kfilter Function to filter the keys (optional).
- vfilter Function to filter the values (optional).
Returns:
-
String with field=value pairs separated by ','.
see also:
- twostr (tab, ksep, vsep, kfilter, vfilter)
-
Builds two lists, of keys and of values.
second with a list of the values.
Parameters:
- tab Table of key=value pairs.
- ksep String with key separator (default = ',').
- vsep String with value separator (default = ',').
- kfilter Function to filter the keys (optional).
- vfilter Function to filter the values (optional).
Returns:
-
Two strings; the first with a list of the fields and the