API

Register

Use this to embed BigLibTimer into your addon. Use either the argument or the return value but not both, because that would be the same as just using the argument.

handler = LibStub:GetLibrary("BigLibTimer6"):Register(handler)
Arguments:
handler
Table or frame to have the BigLibTimer functions saved to.
Returns:
handler
Table with the BigLibTimer functions saved to it.




SetTimer

This is a function used to create a timer.

handler:SetTimer(Name, Seconds, RepeatSeconds, Function, ...)
Arguments:
Name
String that you wish to name a created timer with.
Seconds
Number of seconds until the timer expires or until the timer begins repeating.
RepeatSeconds
Number of seconds to wait before repeating the timer in a loop. Use 0 or nil to not repeat the timer.
Function
Function that will be called when the timer expires or starts another loop.
...
Variable number of arguments that will be passed to the included function when the timer expires or starts another loop.




IsTimer

This is a function used to find out if a timer exists.

found = handler:IsTimer(Name, Search)
Arguments:
Name
String with the name of an existing timer.
Search
If true will cause this function to compare all existing timer names to the specified name.
Returns:
found
Boolean indicating if a specified timer exists.




IsRepeatTimer

This is a function used to find out if a timer that is set to repeat exists.

found = handler:IsRepeatTimer(Name, Search)
Arguments:
Name
String with the name of an existing timer.
Search
If true will cause this function to compare all existing timer names to the specified name.
Returns:
found
Boolean indicating if a specified timer exists.




GetTimer

This is a function to find the seconds remaining on a specified timer.

seconds = handler:GetTimer(Name)
Arguments:
Name
String with the name of an existing timer.
Returns:
seconds
Number indicating the seconds remaining on a specified timer. If the timer is on a loop this will return the seconds remaining until the next loop starts.




ReplaceTimer

This is a function used to replace values inside an existing timer. Values that are nil will not be used except for the function arguments if a function is added. Values that are false or invalid will be cleared except for the function arguments if a function is added. If a function is added all arguments will need to be included, as they will be replaced with the function. This function will not create a timer if it does not find one to replace values in.

found = handler:ReplaceTimer(Name, Seconds, RepeatSeconds, Function, ...)
Arguments:
Name
String with the name of an existing timer.
Seconds
Number of seconds until the timer expires or until the timer begins repeating.
RepeatSeconds
Number of seconds to wait before repeating the timer in a loop. Use 0 to not repeat the timer.
Function
Function that will be called when the timer expires or starts another loop.
...
Variable number of arguments that will be passed to the included function when the timer expires or starts another loop. This will not be used unless a function has been included.
Returns:
found
Boolean indicating if a timer was found to replace values for it.




ClearTimer

This is a function used to remove an existing timer.

found = handler:ClearTimer(Name, Search)
Arguments:
Name
String with the name of an existing timer.
Search
If true will cause this function to compare all existing timer names to the specified name.
Returns:
found
Boolean indicating if any existing timers was found and cleared.




ClearAllTimers

This is a function used to remove all existing timers.

handler:ClearAllTimers()




CreateTable

This is a function used to create a table or use one from an existing pool of available tables to be reused.

Table = handler:CreateTable(Table, All)
Arguments:
Table
Add a table to be wiped and reused.
All
If a table is used for the first argument and this argument is true it will search the table for more tables to be recycled.
Returns:
Table
A newly created table or a wiped table taken from an existing pool of available tables to be reused.




RecycleTable

This is a function used to wipe a table, place in the pool of available tables to be reused, and then delete the reference to the original variable.

Table = handler:RecycleTable(Table, All)
Arguments:
Table
A table to clear and place in the pool of available tables to be reused.
All
If this argument is true it will search the table for more tables to be recycled.
Returns:
Table
This returns nil to clear the original variable.