Module util
Utils to add a few table functions.
Info:
- Author: John Erling Blad < jeblad@gmail.com >
Functions
count () | Raw table count of all the items. |
size () | Size based on the raw table count, or vararg count. |
deepEqual () | Deep equal of two objects. |
include () | Checks if a table include the arg. |
Functions
- count ()
-
Raw table count of all the items.
Simplified variant of
'count()'
(doc)
from Yonaba: Moses.
Approximation of
'size()'
((doc)(https://underscorejs.org/#size))
from jashkenas: Underscore.js
Parameters:
- t table has its entries counted
Returns:
number raw entries - size ()
-
Size based on the raw table count, or vararg count.
This is a slightly weird function, and is a bit spezialised for the moses lib.
Variant of
'size()'
((doc)[http://yonaba.github.io/Moses/doc/#size])
from Yonaba: Moses.
Parameters:
- count table or any entries if table, count varargs otherwise (optional)
Returns:
number counted entries - deepEqual ()
-
Deep equal of two objects.
Simplified variant of
'isEqual()'
((doc)[http://yonaba.github.io/Moses/doc/#isEqual])
from Yonaba: Moses.
Variant of
'isequal()'
((doc)[https://mirven.github.io/underscore.lua/#isequal])
from mirven: Underscore.lua.
Approximation of
'isEqual()'
((doc)(https://underscorejs.org/#isEqual))
from jashkenas: Underscore.js
Variant of
'deepcompare()'
((doc)[http://stevedonovan.github.io/Penlight/api/libraries/pl.tablex.html#deepcompare])
from Penlight: pl.tablex.lua.
Parameters:
- a any type of object
- b any type of object
- useMt boolean indicator for whether to include the meta table (default false)
Returns:
boolean result of comparison - include ()
-
Checks if a table include the arg.
Simplified variant of
'include()'
((doc)[http://yonaba.github.io/Moses/doc/#include])
from Yonaba: Moses.
Simplified variant (defunc) of
'include()'
((doc)[https://mirven.github.io/underscore.lua/#include])
from mirven: Underscore.lua.
Approximation of
'contains()'
((doc)(https://underscorejs.org/#contains))
from jashkenas: Underscore.js
Parameters:
- t table searched for the arg
- arg any item to be searched for
Returns:
boolean result of the operation