WoW:User defined functions

Template:Breadcrumb1

These are cut-and-paste functions that you can use in your addons, submitted by WoWWiki contributors.

Please use Boilerplate: User Defined Function when submitting new functions.

String Functions

GetWords("string")   - Split words on space boundary, return table
strfindt(tabCaptures, ...)   - Wrapper for strfind() that returns captures in a table - can be used in if() clauses!
StringHash("string")   - Create a fair-quality 32-bit hash of a string
printMSG("string")   - Displays a custom message to the default chat frame, for the user to see (time, code and size saver).

Table Functions

tinsertbeforeval(tab, valBefore, val)   - Insert one value before another (without knowing its index)
tremovebyval(tab, val)   - Remove a value (without knowing its index)
tcount(tab)   - Count table members (works on non-integer-indexed tables)
tcopy(tabTo, tabFrom)   - Recursively copy contents of one table to another

Time Functions

GameTime:Get()   - Get server time including seconds and milliseconds

See also