Global Functions
Donxon Global Functions.
Functions that are accessible at a global level.
-
IsGameModule ()
-
Checks whether Game module is loaded.
Returns:
bool
Returns true if Game module is loaded.
-
IsUIModule ()
-
Checks whether UI module is loaded.
Returns:
bool
Returns true if UI module is loaded.
-
AssertType (name, datatype, value[, level[, condition[, hop]]])
-
Asserts based on value's data type.
Parameters:
- name
string
The value's variable name.
- datatype
string
The expected data type.
- value
anything
The value to checks.
- level
string
The value's level (property, class, function, etc).
(optional)
- condition
bool
The condition to be satisfied.
(optional)
- hop
number
Uses error instead and this is error level hopping number.
(optional)
-
math.clamp (min, max, value)
-
Clamps a number between a minimum and maximum value.
Parameters:
- min
number
The minimum value, this function will never return a number less than this.
- max
number
The maximum value, this function will never return a number greater than this.
- value
number
The number to clamp.
Returns:
number
The clamped value.
-
math.round (num[, numDecimalPlaces=0])
-
Rounds the number.
Parameters:
- num
number
The value to round.
- numDecimalPlaces
number
The number of decimal place(s).
(default 0)
Returns:
number
The rounded number.
-
string.explode (source, delimiter)
-
Splits a string into a table.
Parameters:
- source
string
The string to explode.
- delimiter
string
The string delimiter.
Returns:
table
The result.
-
.extendedTable
-
The extended table.
- _base
table
The base table.
- _parent
table
The parent table inheret from. It could be same as
_base
.
- ...
The derived table's members.
-
.extendedMetatable
-
The extended table's metatable.
- __hasWriteOnlyMember
bool
This table has write-only member(s).
(default false)
- __functionSelfOverride
bool
Sets derived table as
self
when accessing base's functions.
(default false)
- __index_old
table, function or nil
The original __index.
- __index
function
The extended __index.
- __newindex_old
table, function or nil
The original __newindex.
- __newindex
function
The extended __newindex.
-
table.readonly (table[, msg])
-
Sets the table access to read-only using
metatable
.
Parameters:
- table
table
The table to set.
- msg
string
The error message when invokes table editing.
(optional)
Returns:
table
The result.
-
table.extend (base, derived[, hasWriteOnlyMember[, functionSelfOverride]])
-
Extends a table using
metatable
.
Parameters:
- base
table
The base index table.
- derived
table
The derived table.
- hasWriteOnlyMember
bool
Base table has write-only members.
(optional)
- functionSelfOverride
bool
Sets derived table as
self
when accessing base or parent's functions.
(optional)
Returns:
.extendedTable
The extended derived table.
-
table.merge (target, source[, deep=false])
-
Merges two tables.
Parameters:
- target
table
The target table to merge with.
- source
table
The source table.
- deep
bool
Do recursive merge.
(default false)
Returns:
table
The merget target table.
-
table.clone (source[, deep=true[, seen=nil]])
-
Clones a table.
Parameters:
- source
table
The source table to clone.
- deep
bool
Do recursive copy.
(default true)
- seen
table
Last seen sub-table.
(default nil)
Returns:
table
The cloned table.