WoW:User defined functions: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 1: | Line 1: | ||
{{breadcrumb1|Interface Customization}} | |||
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 [[API strfind|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 | |||
== 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 == | |||
* [[:Category:HOWTOs]] - most have cut-and-pasteable code snippets | |||
[[Category:Interface Customization]] | [[Category:Interface Customization]] | ||
[[Category: | [[Category:User Defined Functions| {{PAGENAME}}]] |
Revision as of 10:07, 21 August 2006
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
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
- Category:HOWTOs - most have cut-and-pasteable code snippets