Table
Summary
Methods
| deepCopy (tbl: table) : table |
| sizeOf (tbl: table, recursive: boolean) : number |
| reconcile (tbl: table, source: table) : table |
| disconnectTable (tbl: table, recursive: boolean?, clear: boolean?) |
Methods
deepCopy
Returns a deep copy of the given table. This method recursively copies all nested tables.
Table.deepCopy ( tbl: table ) : table
Parameters
| tbl : table |
Returns
| table |
sizeOf
Returns the number size of the provided table. When using the recursive option, note that nested tables will have their Size + 1 added to the total size.
Table.sizeOf ( tbl: table, recursive: boolean ) : number
Parameters
| tbl : table |
| recursive : boolean Whether to include nested tables in the size calculation. Defaults to false. |
Returns
| number |
local Table = Utility.Table
local myDictionary = {
fruits = {
{ "granny smith", "sour apple" },
"banana",
"cherry"
},
inSeason = true
}
local size = Table.sizeOf(myDictionary, true)
print(size) --> 7 (2 without recursive option)
reconcile
Reconciles the contents of the tbl table to match the source table. This method will recursively update nested tables and add keys as necessary to make the tbl table identical to the source table.
Table.reconcile ( tbl: table, source: table ) : table
Parameters
| tbl : table The table to be modified to match the source. |
| source : table The table that serves as the reference for reconciliation. |
Returns
| table |
local Table = Utility.Table
local tbl = {
fruits = {
"apple",
"banana"
},
inSeason = false
}
local source = {
fruits = {
"apple",
"banana",
"cherry"
},
inSeason = true
}
Table.reconcile(tbl, source)
print(tbl.fruits[3]) --> "cherry"
disconnectTable
Disconnects all RBXScriptConnection objects and custom signal implementations (if they have a Disconnect method).
Table.disconnectTable (
tbl: table, recursive: boolean?, clear: boolean?
) : ()
Parameters
| tbl : table |
| recursive : boolean? Whether to include nested tables in the disconnection process. Defaults to false. |
| clear : boolean? Whether to also clear the tables after disconnecting. Defaults to false. |