diff --git a/init.lua b/init.lua index de34e2f..cf63c2d 100644 --- a/init.lua +++ b/init.lua @@ -34,6 +34,11 @@ -- Module-level state (all local — no globals) -- ----------------------------------------------------------------------- +-- Module-table declared early so closures in module-local helpers below +-- can reference M.X functions. Method assignments (function M.x() ... end) +-- still land further down once the public surface section starts. +local M = {} + local widgets = {} -- widget_id (string) → widget_def table local active = nil -- active widget_id or nil local theme = {} -- merged DEFAULT_THEME + overrides @@ -187,11 +192,8 @@ local function _dispatch_event(event) end -- ----------------------------------------------------------------------- --- Public module table +-- Public API (M declared at top of file so closures above can reference it) -- ----------------------------------------------------------------------- - -local M = {} - -- ----------------------------------------------------------------------- -- Registry / Lifecycle -- -----------------------------------------------------------------------