OPX//77
opx_lib

Lib.Table

Last updated on

Deep copy, deep compare, sorted keys, counting and read-only views.

Pure. No permission.

Lib.Table.Copy

A deep copy with no shared reference to the original.

Lib.Table.Copy(value, seen)

Parameters

  • value: any
  • seen?: table — internal, for cycles; leave it out.

Returns

  • any — the copy
Example
local mine = Lib.Table.Copy(defaults)

Lib.Table.Same

Whether two values are the same data, to any depth.

Lib.Table.Same(left, right)

Parameters

  • left: any
  • right: any

Returns

  • boolean

Lib.Table.Keys

Every key, sorted, so a walk is the same twice.

Lib.Table.Keys(value)

Parameters

  • value: table

Returns

  • any[]

Lib.Table.Count

How many entries a table holds, map keys included.

Lib.Table.Count(value)

Parameters

  • value: table

Returns

  • integer

Lib.Table.Freeze

A shallow read-only view: reading works, writing raises.

Lib.Table.Freeze(value)

Parameters

  • value: table

Returns

  • table

On this page