Module Double
Class for doubles.
Functions
meta:__call () | Get arguments for a functionlike call. |
obj:setName () | Set identifying name |
obj:hasName () | Has set name. |
obj:setLevel () | Set stack level. |
obj:hasLevel () | Has set level. |
obj:setOnEmpty () | Set on empty fallback. |
obj:hasOnEmpty () | Has set empty fallback. |
obj:isEmpty () | Is the list of values empty. |
obj:depth () | What is the depth of the internal values list. |
obj:layout () | Get the layout of the values list. |
obj:add () | Add value(s) to the list of values. |
obj:remove () | Remove value from the list of values. |
obj:stub () | Return a stub function for the object. |
obj:hasStub () | Has set stub function. |
obj:export () | Export a list of all the contents. |
obj:flush () | Flush all the contents. |
double.new () | Create a new instance. |
Functions
- meta:__call ()
-
Get arguments for a functionlike call.
Parameters:
- ... vararg pass on to dispatch
Returns:
self - obj:setName ()
-
Set identifying name
Parameters:
- name nil or string used for error reports
Returns:
selfRaises:
on wrong arguments - obj:hasName ()
-
Has set name.
Returns:
boolean - obj:setLevel ()
-
Set stack level.
Parameters:
- level nil or number where to start reporting
Returns:
selfRaises:
on wrong arguments - obj:hasLevel ()
-
Has set level.
Returns:
boolean - obj:setOnEmpty ()
-
Set on empty fallback.
Parameters:
- func nil or function fallback to be used in place of precomputed values
Returns:
selfRaises:
on wrong arguments - obj:hasOnEmpty ()
-
Has set empty fallback.
Returns:
boolean - obj:isEmpty ()
-
Is the list of values empty.
Note that the internal structure is non-empty even if a nil
is shifted into the values list.
Returns:
boolean whether the internal values list has length zero - obj:depth ()
-
What is the depth of the internal values list.
Note that the internal structure has a depth even if a nil
is shifted into the values list.
Returns:
number how deep is the internal structure - obj:layout ()
-
Get the layout of the values list.
This method is used for testing to inspect which types of objects exists in the values list.
Returns:
table description of the internal structure - obj:add ()
-
Add value(s) to the list of values.
Parameters:
- ...
Returns:
self facilitate chaining - obj:remove ()
-
Remove value from the list of values.
Parameters:
- num
Returns:
any item that can be put on the internal structure - obj:stub ()
-
Return a stub function for the object.
Each call to the returned closure will remove one case of values from the internal structure.
Returns:
closure - obj:hasStub ()
- Has set stub function. treturn boolean
- obj:export ()
-
Export a list of all the contents.
Returns:
table list of values - obj:flush ()
-
Flush all the contents.
Note that this clears the internal storage.
Returns:
table list of values - double.new ()
-
Create a new instance.
Parameters:
- ... vararg arguments to be passed on
Returns:
self