File hp/lang/table.lua

Functions

M.copy (src, dest) The shallow copy of the table.
M.decorate (src, arg1, arg2) Table decorate is useful for decorating objects when using tables as classes.
Author:Nenad Katic
@param: arg1 - string=new key when string, needs arg2 - table=will extend all key/values arg2(optional)
M.deepCopy (src, dest) The deep copy of the table.
M.extend (src, dest) table.override and table.extend are very similar, but are made different routines so that they wouldn't be confused Author:Nenad Katic
M.indexOf (array, value) Returns the position found by searching for a matching value from the array.
M.insertElement (t, o) Adds an element to the table.
M.keyOf (src, val) Same as indexOf, only for key values (slower) Author:Nenad Katic
M.removeElement (t, o) This removes the element from the table.
table.override (src, dest, onlyExistingKeys) Copies and overrides properties from src to dest.
If onlyExistingKeys is true, it *only* overrides the properties.
Author:Nenad Katic

Tables

table modules that extend functionality of the table.


Functions

M.copy (src, dest)
The shallow copy of the table.

Parameters

  • src: copy
  • dest: (option)Destination

Return value:

dest
M.decorate (src, arg1, arg2)
Table decorate is useful for decorating objects when using tables as classes.
Author:Nenad Katic
@param: arg1 - string=new key when string, needs arg2 - table=will extend all key/values arg2(optional)

Parameters

  • src:
  • arg1:
  • arg2:
M.deepCopy (src, dest)
The deep copy of the table.

Parameters

  • src: copy
  • dest: (option)Destination

Return value:

dest
M.extend (src, dest)
table.override and table.extend are very similar, but are made different routines so that they wouldn't be confused Author:Nenad Katic

Parameters

  • src:
  • dest:
M.indexOf (array, value)
Returns the position found by searching for a matching value from the array.

Parameters

  • array: table array
  • value: Search value

Return value:

If one is found the index. 0 if not found.
M.insertElement (t, o)
Adds an element to the table. If the element was present, the element will return false without the need for additional. If the element does not exist, and returns true add an element.

Parameters

  • t: table
  • o: element

Return value:

If it already exists, false. If you add is true.
M.keyOf (src, val)
Same as indexOf, only for key values (slower) Author:Nenad Katic

Parameters

  • src:
  • val:
M.removeElement (t, o)
This removes the element from the table. If you have successfully removed, it returns the index of the yuan. If there is no element, it returns 0.

Parameters

  • t: table
  • o: element

Return value:

index
table.override (src, dest, onlyExistingKeys)
Copies and overrides properties from src to dest.
If onlyExistingKeys is true, it *only* overrides the properties.
Author:Nenad Katic

Parameters

  • src:
  • dest:
  • onlyExistingKeys:

Tables

table
modules that extend functionality of the table.

Valid XHTML 1.0!