File SMTables.mys

Tables utility functions.

Section

SectionSummary
TablesTables utility functions.

Summary

Return typeFunction and summary
 ArrayClear(table t)
Optimization of clearing a table.
boolArrayContains(table tab, term)
Does tab contains term?
boolisTable(obj)
Returns true if obj is a table or a MyrScript object represented as a table such as Score or Target.
 tdebug(tab)
Return the structure of a table, Collection or Map for debugging to the console.

Functions

isTable(obj)

Returns true if obj is a table or a MyrScript object represented as a table such as Score or Target.

ParameterTypeDefaultDescription
obj   
Return
bool:

tdebug(tab)

Return the structure of a table, Collection or Map for debugging to the console.

ParameterTypeDefaultDescription
tab   

ArrayClear(table t)

Optimization of clearing a table.

tremove is time consuming because it shift all items after the removed one.
tremove from last to first would be a bit faster.
but setting items to nil is even faster.

ParameterTypeDefaultDescription
ttable The table to clear.

ArrayContains(table tab, term)

Does tab contains term?

ParameterTypeDefaultDescription
tabtable A table of numbers or strings
term  A number or a string to find in tab
Return
bool: true, or ni (for false)
Error
if tab's items are not comparable with term