Skip to main content
Main.lua loads last and drives the runtime. It builds two OnUpdate frames: UpdateFrame (per-frame) and OnTickFrame (throttled).

volvox:Init()

function volvox:Init()
Bootstraps the framework, called once at the bottom of Main.lua:
  1. Initializes the minimap button (volvox.Minimap:Initialize()).
  2. Creates the update/tick callback registries and seeds the 5-sample rolling tick-time window.
  3. Creates the two driver frames via volvox:InitializeFrames() (this sets volvox.isLoaded = true).
  4. Restores persisted module state with volvox.Module:InitializeAll() and enables volvox.EventHandler.

Tick modes

The tick loop’s throttle is controlled by two config keys:
KeyDefaultBehavior
general.tickmode"Dynamic""Dynamic": a tick fires when the elapsed time reaches volvox.minimumTickTime (math.max(0.1, 1 / GetFramerate())). Any other value (Fixed): uses general.tickrate.
general.tickrate0.1Fixed tick interval in seconds
Both are editable on the built-in General settings page. Each tick also processes deferred module callbacks (volvox.Module:ProcessPendingCallbacks()).

Registering callbacks

---@param callback fun(elapsed: number)
---@param enabled? boolean
---@return number id
function volvox:OnTick(callback, enabled)
function volvox:OnUpdate(callback, enabled)
  • OnUpdate callbacks run every frame; OnTick callbacks run at the throttled tick rate.
  • Both return a numeric id for later removal. Passing enabled = false registers the callback in a disabled state.
Tick callbacks receive the rolling average tick delta (a 5-sample average), not the raw elapsed time.
---@param id number
---@param isUpdate? boolean
---@return boolean success
function volvox:RemoveCallback(id, isUpdate)
Removes a callback by id. Pass isUpdate = true for callbacks registered with OnUpdate; false/nil searches the tick list.

Example

local id = volvox:OnTick(function(elapsed)
  -- throttled work
end)

-- later
volvox:RemoveCallback(id)

Other members defined in Main.lua

MemberPurpose
volvox.FRAMEWORK_BUILDBuild identifier string, logged at startup
volvox:IsGathererEnabled()true when the Gatherer module is enabled and global State is not PAUSE/DEAD
volvox:ExecuteUpdateCallbacks(elapsed) / volvox:ExecuteTickCallbacks(elapsed)Internal loop plumbing
volvox:CalculateAverageTickTime() / volvox:UpdateTickTime()Maintain the 5-sample rolling tick average
Main.lua also schedules a deferred GUI bring-up (~0.5 s after load) that restores the LootRoute settings category and initializes the settings window.