Module CorsixTH.CorsixTH.Lua.utility
Find the smallest bucket with its upper value less or equal to a given number, and return the value of the bucket, or its index.
Functions
| array_join (array, separator) | Convert an array table to a string. |
| hasBit (value, bit) | Check bit is set |
| serialize (val, options, depth, pt_reflist) | Serialize a value. |
Functions
- array_join (array, separator)
-
Convert an array table to a string.
Joins each elements by the provided separator. As a convenience feature
if the input is not an array it will be converted to a string and
returned.
Parameters:
- array (table) array to join.
- separator (string) separator between elements.
Returns:
-
(string) The joined string.
- hasBit (value, bit)
-
Check bit is set
Parameters:
- value (int) value to check set bit of
- bit (int) 0-base index of bit to check
Returns:
-
(boolean) true if bit is set.
- serialize (val, options, depth, pt_reflist)
-
Serialize a value. Call it with the value to serialize and print the output.
By default it will end recursion when a cycle is detected.
Parameters:
- val Value to serialize.
- options Option settings, table, 'detect_cycles' field boolean that ends recursion on a cycle, and 'max_depth' integer that ends recursion at the specified depth. By default initialized with "{detect_cycles = True}"
- depth Recursion depth, should be omitted.
- pt_reflist Seen nodes, should be omitted.
Returns:
-
The seralized output.