--variables and upvalues |
local count = 0 |
|
------------------------------ |
-- HOW TO CREATE A MODULE -- |
------------------------------ |
|
-- First, create your module. Pass in a key identifier for your module (ex. "clock"). |
-- Your key identifier should be UNIQUE to your module, and not the same as another module's. |
-- This function will return references to your module's frame and fontstring. |
-- USAGE: sStats:CreateModule(key) |
-- key = a unique identifier/name of your module - a "string" |
|
local sStats_clock, sStats_clockText = sStats:CreateModule("clock") |
|
------------------------------------------------------- |
-- Next, register for a callback to know when your module is ready to be used. |
-- When this event fires, the module's fontstring is ready for text, the variables are |
-- loaded and can be read, and the options tables are created and you can add to them. |
-- USAGE: sStats.RegisterCallback(module, event, method) |
-- module = the module registering for the callback |
-- event = the event fired by sStats - it is called "sStats_Modules_Ready" |
-- method = the function to call when the event fires (may be declared elsewhere in your |
-- module's code or right in the RegisterCallback script) |
|
sStats.RegisterCallback(sStats_clock, "sStats_Modules_Ready", function() |
---------------------------------------------------------- |
sStats_clock:SetScript("OnUpdate", function(self, elapsed) |
count = count + elapsed |
if count >= 1 then |
local time, suffix = strsplit(" ", GameTime_GetTime(true)) |
|
--------------------------------------------------------------------------- |
-- To set the text of your module, this optional function exists to ensure that |
-- modules use the same format and colors set in the options. |
-- If desired, you may just use module:SetText() instead, on your own. |
|
sStats:SetModuleText(sStats_clockText, time, " "..suffix) |
--------------------------------------------------------------------------- |
|
count = 0 |
end |
end) |
|
end) |