Module table.extra

Table manipulation and transformation functions.

Info:

  • Release: $Id: extra.lua,v 1.19 2017/04/05 19:14:08 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 (should return a string) to filter the keys (optional).
  • vfilter Function (should return a string) 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 (should return a string) to filter the keys (optional).
  • vfilter Function (should return a string) 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.

Parameters:

  • tab Table of key=value pairs.
  • ksep String with key separator (default = ',').
  • vsep String with value separator (default = ',').
  • kfilter Function (should return a string) to filter the keys (default = tostring).
  • vfilter Function (should return a string) to filter the values (default = tostring).

Returns:

    Two strings; the first with a list of the fields and the second with a list of the values.
generated by LDoc 1.4.6 Last updated 2017-04-05 16:14:10