table


require "list" FIXME: allow require loops


FIXME: use consistent name for result table: t_? (currently r and
u)


sort: Make table.sort return its result
  t: table
  c: comparator function
returns
  t: sorted table


empty: Say whether table is empty
  t: table
returns
  f: true if empty or false otherwise


size: Find the number of elements in a table
  t: table
returns
  n: number of elements in t


indices: Make the list of indices of a table
  t: table
returns
  u: list of indices


values: Make the list of values of a table
  t: table
returns
  u: list of values


invert: Invert a table
  t: table {i=v...}
returns
  u: inverted table {v=i...}


rearrange: Rearrange some indices of a table
  m: table {oldindex=newindex...}
  t: table to rearrange
returns
  r: rearranged table


clone: Make a shallow copy of a table, including any
metatable (for a deep copy, use tree.clone)
  t: table
  nometa: if non-nil don't copy metatable
returns
  u: copy of table


merge: Merge two tables
If there are duplicate fields, u's will be used. The metatable of
the returned table is that of t
  t, u: tables
returns
  r: the merged table


new: Make a table with a default entry value
  [x]: default entry value [nil]
  [t]: initial table [{}]
returns
  u: table for which u[i] is x if u[i] does not exist