Skip to content

History / Authoring Lua Callbacks

Revisions

  • Adding detail for the new location updating/updated callbacks

    @codemann8 codemann8 committed Apr 23, 2026
  • Lua Autotracking: register watches at pack init, not on connect The autotracker icon's visibility depends on at least one memory watch being registered (Active = mApplicableProviders.Count > 0 && mActiveMemoryUpdates.Count > 0 in AutoTrackerExtension). Watches must therefore be registered during pack initialization, NOT in the autotracker_started callback — otherwise the icon never appears and the user has nothing to click to start autotracking. - Rewrite the lifecycle section: pack init creates watches → icon appears → user connects → autotracker_started fires → callbacks poll → autotracker_stopped fires (watches stay registered) - Move every example out of autotracker_started and into init.lua- loaded scripts, including the multi-watch and manual-removal examples - Note that AddMemoryWatch does not require an active provider - Note that removing all watches hides the icon - Update Tips and pitfalls to flip the previous (incorrect) advice - Reframe autotracker_started as for per-connection setup, not registration. Mark it as optional. - Mirror the corrections on the Standard Callbacks page (table row, example block, and the new pitfall bullet)

    @claude claude committed Apr 8, 2026
  • Add Authoring Lua Scripts hierarchy - Authoring Lua Scripts: top-level overview of the scripting environment, what Lua does in a pack, the NLua sandbox model (removed os methods, no io for non-unsafe packs, removed import, rewired print), the six injected globals, and a sub-page index - init.lua: entry-point conventions, load-order rules, variant detection via Tracker.ActiveVariantUID, ScriptHost:LoadScript vs require, where to define custom logic and callbacks - Standard Callbacks: every well-known function name the runtime invokes (tracker_on_pack_ready, *_accessibility_*, save load bracket, autotracker_started/stopped), re-entrancy protection, examples - Custom Access Rules: deep dive on the $ prefix dispatch into Lua, the count + AccessibilityLevel return contract, pipe- separated args, where to define functions, caching semantics - Autotracking: lifecycle, ScriptHost:AddMemoryWatch usage, IMemorySegment read API, item-update patterns by item type, multiple watches with per-period polling, removing watches - Lua Items: ScriptHost:CreateLuaItem, full property/callback reference, when to use vs built-in items, complete worked example, save/load via SaveFunc/LoadFunc - API Reference: full reference for Tracker, AutoTracker, Layout, ScriptHost, ImageReference, AccessibilityLevel, NotificationType, and the IMemorySegment interface - Sidebar updated with the full hierarchy under For Developers

    @claude claude committed Apr 8, 2026