Module Table
A module with helper functions related to tables.
Info:
- License: MIT
- Author: Richard Voelker
Functions
ArrayToSingleLineString (array) | Reads an array-like table and converts it into a single-line string. |
HashMapToSingleLineString (map) | Reads a HashMap and converts it into a single-line string. |
HashMapToMultiLineString (map, depth) | Returns a HashMap as a string representation across multiple lines. |
TablesAreEqual (tableOne, tableTwo) | Performs a deep comparison of two tables to check if they are equal. |
Swap (t, i1, i2) | Swap the values of two elements in a table. |
Functions
- ArrayToSingleLineString (array)
-
Reads an array-like table and converts it into a single-line
string.
Parameters:
- array
table
The array-like table to turn into a
string.
Returns:
-
string
The array as a single-line string.
- array
table
- HashMapToSingleLineString (map)
-
Reads a HashMap and converts it into a single-line string.
Parameters:
Returns:
- HashMapToMultiLineString (map, depth)
-
Returns a HashMap as a string representation across
multiple lines.
Parameters:
- map HashMap The HashMap to turn into a string.
- depth integer [opt=0] How many tabs to print at the start of the string.
Returns:
- TablesAreEqual (tableOne, tableTwo)
-
Performs a deep comparison of two tables to check if they
are equal.
Parameters:
Returns:
-
boolean
True if the two tables are equal.
- Swap (t, i1, i2)
-
Swap the values of two elements in a table.
Parameters:
- t table The table to swap elements in.
- i1 The key of the first element.
- i2 The key of the second element.