ExtraTable
Plenty of useful utilities and common functions for interacting with tables.
Summary
Function
Function
Function
Function
Function
Function
Function
Function
Function
Function
Function
Function
Methods
ShallowCopy()
table ShallowCopy(table original)
Returns a replica of table
where nested tables are empty. Useful for when you want to edit the values of an array without changing the original.
DeepCopy()
table DeepCopy(table original)
Returns a replica of table
where any nested tables are also recursively copied.
Pick()
any Pick(array array, RNG? rng)
Returns a random value from an array. If rng
is omitted, an RNG
object with a seed equivalent to the game's current frame count and a shift index of 35 will be created.
IsArray()
boolean IsArray(any value)
Returns true if the provided value is an array or if it is an empty table.
IsDictionary()
boolean IsDictionary(any value)
Returns true if the provided value is a dictionary.
HasValue()
boolean HasValue(table table, any value)
Returns true if the value
exists as a value within table
.
HasKey()
boolean HasKey(table table, any key)
Returns true if key
exists as a key within table
.
Length()
int Length(table table)
Returns the amount of entries in table
. Works for dictionaries and arrays.
IsEmpty()
boolean IsEmpty(table table)
Returns true if the amount of entries in table
is 0.
Set()
dictionary Set(array array)
Returns a new dictionary where there is a key for each entry in array
and all values set to true
.
Find()
any? Find(table table, any value)
Returns the index in which value
appears in table
, or nil
if not found.
PrettyPrint()
void PrettyPrint(table master, int? depthLimit)
Recursively prints the key-value pairs of master
. If the method goes depthLimit
nested tables deep, it will stop going deeper. By default, depthLimit
is 3.
Last updated