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


subscript: Expose [] as a function
  t: table
  s: subscript
returns
  v: t[s]


lookup: Do a late-bound table lookup
  t: table to look up in
  l: list of indices {l1 ... ln}
returns
  u: t[l1]...[ln]


pathSubscript: Subscript a table with a string containing
dots
  t: table
  s: subscript of the form s1.s2. ... .sn
returns
  v: t.s1.s2. ... .sn


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
  t: table
  nometa: if non-nil don't copy metatables
returns
  u: copy of table


deepclone: Make a deep copy of a table, including any
metatable
  t: table
  nometa: if non-nil don't copy metatables
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


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