AIOS Core v4.0.0

AIOS Core is a revolutionary standalone framework for World of Warcraft addon development. Built from the ground up with performance and memory efficiency in mind, it provides a comprehensive ecosystem for building modern, efficient addons with zero dependencies.

Retail

12.0.0 11.x

Classic Era

1.15.x

MoP Classic

5.4.x

Architecture

Standalone Zero Dependencies
🚀 God-Tier Performance: AIOS Core v4.0.0 introduces the revolutionary Lean Memory Optimization System that automatically optimizes your plugins with table pooling, string interning, and lazy loading.

Installation

AIOS Core is a complete standalone addon with its own folder structure and TOC file.

Folder Structure

Interface/
└── AddOns/
   └── AIOS/
      ├── AIOS.toc
      ├── AIOS_Core.lua
      └── Doc/
         └── icon.tga

AIOS.toc Contents

## Interface: 120000, 110205, 11507, 50501, 40400
## Title: |cff00aaffAIOS|r
## Notes: |cff00aaffAdvanced Interface Optimization System — Core Framework|r
## Author: |cffffffffPoorkingz|r
## Version: |cff00ff00v4.0.0|r
## SavedVariables: AIOS_Saved, AIOS_Config
## DefaultState: Enabled
## LoadOnDemand: 0
## IconTexture: Interface\AddOns\AIOS\Doc\icon.tga

AIOS_Core.lua
Retail
12.0.0
Classic
1.15.7
MoP Classic
5.4.8
WotLK Classic
3.4.3

Verification

After installation, verify AIOS Core is loaded by typing /aiosdiag in game. You should see diagnostic information about the framework.

Quick Start

Since AIOS is its own standalone addon, other addons can use it by simply ensuring AIOS is installed and enabled. Here's how to create an AIOS-powered addon:

Your Addon's Structure

Interface/
└── AddOns/
   ├── AIOS/
   │   ├── AIOS.toc
   │   └── AIOS_Core.lua
   └── MyAddon/
       ├── MyAddon.toc
       └── MyAddon.lua

MyAddon.lua Example

-- MyAddon.lua

-- Create your plugin table
local MyAddon = {
    version = "1.0.0",
    author = "Your Name",
    description = "My awesome AIOS-powered addon"
}

function MyAddon:OnInitialize()
    -- Called when AIOS Core is ready and your plugin is registered
    print("MyAddon initialized with AIOS Core!")
    
    -- Register WoW events through AIOS
    AIOS:RegisterEvent("PLAYER_ENTERING_WORLD", function()
        print("Player entered world!")
    end)
    
    -- Use Lean optimization features automatically available
    local temp = self.getTable(5)
    temp.message = self.stringManager:get("Hello from MyAddon!")
    print(temp.message)
    self.recycleTable(temp)
end

function MyAddon:OnEnable()
    -- Called when your plugin is enabled
    print("MyAddon enabled!")
end

function MyAddon:OnDisable()
    -- Called when your plugin is disabled
    print("MyAddon disabled!")
end

-- Register with AIOS Core
AIOS:RegisterPlugin("MyAddon", MyAddon)
💡 Note: Your plugin automatically gains access to Lean optimization features without any additional setup. AIOS must be installed and enabled for your addon to work.

Architecture

AIOS Core is built around a modular, service-oriented architecture:

Core Framework

Foundation layer providing plugin management, logging, and safe execution utilities.

Bootstrap Plugin Host Safe Execution

Event Systems

Dual event systems: native WoW events with priority, and custom SignalHub for internal messaging.

WoW Events SignalHub Priority Handling

Service Registry

Dependency injection and service management for shared functionality across plugins.

DI Container Service Discovery Lazy Loading

Lean Optimization

Advanced memory management with automatic table pooling, string interning, and performance modes.

Memory Pooling String Interning Performance Modes

Event System

AIOS provides a robust event system for handling WoW's native events with priority support and error handling.

-- Register event with priority (higher = executed first)
local handler = AIOS:RegisterEvent("PLAYER_LOGIN", function()
    print("Player logged in!")
end, 10) -- Priority 10

-- Unregister when done
handler:Unregister()

-- Or unregister all handlers for an event
AIOS:UnregisterEvent("PLAYER_LOGIN")

SignalHub

SignalHub provides custom event/messaging system for internal communication between plugins and components.

-- Listen for custom signals
AIOS.SignalHub:Listen("DataUpdated", function(data)
    print("Data was updated:", data)
end)

-- Emit signals
AIOS.SignalHub:Emit("DataUpdated", { items = 5, status = "ready" })

-- One-time listeners
AIOS.SignalHub:Once("InitialLoad", function()
    print("Initial load complete!")
})

ServiceRegistry

The ServiceRegistry allows plugins to define and share services across the entire AIOS ecosystem.

-- Define a service
AIOS.ServiceRegistry:Define("Logger", "1.0.0", function()
    return {
        Log = function(msg) print("LOG:", msg) end,
        Error = function(msg) print("ERROR:", msg) end
    }
end)

-- Use the service
local logger = AIOS.ServiceRegistry:Get("Logger")
logger:Log("This is a log message")

Plugin System

AIOS plugins are modular components that automatically gain access to all framework features including Lean optimization.

local MyPlugin = {
    version = "1.0.0",
    author = "Developer",
    description = "My AIOS Plugin"
}

function MyPlugin:OnInitialize()
    -- Plugin initialization
end

function MyPlugin:OnEnable()
    -- Plugin enabled
end

function MyPlugin:OnDisable()
    -- Plugin disabled
end

-- Register with optional dependencies
AIOS:RegisterPlugin("MyPlugin", MyPlugin, {"Logger", "Database"})

Core Features

Automatic Lean Integration

Every registered plugin automatically gains Lean optimization capabilities:

function MyPlugin:SomeFunction()
    -- Get a pooled table (automatically managed)
    local temp = self.getTable(10)
    
    -- Use string interning for repeated strings
    temp.message = self.stringManager:get("Frequently used string")
    
    -- Recycle when done
    self.recycleTable(temp)
end

Service Registry

Share functionality across multiple plugins:

-- Define a service
AIOS.ServiceRegistry:Define("Database", "1.0.0", function()
    return {
        GetData = function(key) return savedData[key] end,
        SetData = function(key, value) savedData[key] = value end
    }
end)

-- Use the service
local db = AIOS.ServiceRegistry:Get("Database")
db:SetData("setting", true)

Lean Memory Optimization System

The Lean system is AIOS Core's revolutionary approach to memory management in WoW addons. It dramatically reduces garbage collection pressure and improves overall performance.

Table Pooling

Reuse tables instead of creating new ones:

function MyPlugin:ProcessData(data)
    -- Get a pre-allocated table
    local result = self.getTable(#data)
    
    for i, item in ipairs(data) do
        result[i] = self:ProcessItem(item)
    end
    
    -- Use the result...
    self:DisplayResult(result)
    
    -- Return to pool when done
    self.recycleTable(result)
end

String Interning

Reduce memory usage by reusing identical strings:

function MyPlugin:CreateUI()
    -- These will reference the same string object
    local title = self.stringManager:get("My Awesome Addon")
    local desc = self.stringManager:get("My Awesome Addon") -- Same reference!
    
    -- Ideal for frequently used UI strings, labels, etc.
end

Lazy Loading

Defer expensive operations until needed:

-- Heavy data won't be loaded until first access
local heavyData = self.lazyLoad("Configuration", function()
    return LoadHeavyConfig() -- Expensive operation
end)

-- The load function is only called here, on first access
print(heavyData.setting)

WithLean Micro-Transaction Pattern

The ultimate convenience method for temporary table usage:

-- No manual get/recycle needed
local result = self:WithLean(function(temp)
    temp.data = "processing"
    temp.count = 42
    temp.items = {1, 2, 3}
    return "Processed " .. temp.count .. " items"
end)

print(result) -- "Processed 42 items"
💡 Pro Tip: Use WithLean for any function that needs temporary tables. It automatically handles pooling and eliminates memory leaks.

Core API Reference

Method Description Returns
AIOS:RegisterPlugin(id, plugin [, deps]) Register a plugin with AIOS Core void
AIOS:WithLean(fn [, ...]) Execute function with temporary pooled table fn result
AIOS:SafeCall(fn [, ...]) Safely execute function with error handling result, error
AIOS:RegisterEvent(event, handler [, priority]) Register WoW event handler handler object
AIOS:UnregisterEvent(event) Unregister all handlers for event void
AIOS:SetLogLevel(level) Set framework log level (1-5 or "ERROR".."TRACE") void
AIOS:GetMeta() Get comprehensive framework metadata table

Lean API Reference

Method Description Context
plugin.getTable([sizeHint]) Get pooled table from Lean system Plugin
plugin.recycleTable(table [, sizeHint]) Return table to pool for reuse Plugin
plugin.stringManager:get(str) Get interned string (reuses existing) Plugin
plugin.lazyLoad(name, loader [, priority]) Create lazy-loaded data proxy Plugin
plugin.WithLean(fn [, ...]) Micro-transaction with pooled table Plugin
AIOS.Lean:getMetrics() Get Lean optimization statistics Global
AIOS.Lean:setPerformanceMode(mode) Set performance mode Global

Plugin API Reference

Method Description Context
plugin:OnInitialize() Called when plugin is registered Plugin
plugin:OnEnable() Called when plugin is enabled Plugin
plugin:OnDisable() Called when plugin is disabled Plugin
plugin.Memory Persistent storage for plugin data Plugin

Events API Reference

Method Description Context
AIOS:RegisterEvent(event, handler) Register WoW event handler Global
handler:Unregister() Unregister specific event handler Handler
AIOS.SignalHub:Listen(signal, handler) Listen for custom signals Global
AIOS.SignalHub:Emit(signal, ...) Emit custom signal Global

Slash Commands

Quick Diagnostics

/aiosdiag          -- System overview
/aiosdiag full     -- Detailed diagnostics with Lean metrics
/aiosdiag example  -- Show Lean usage examples

Lean Management

/aioslean          -- Show Lean optimization status
/aioslean gc       -- Force garbage collection
/aioslean mode balanced  -- Set performance mode
/aioslean example  -- Demonstrate WithLean pattern

Performance Modes

Diagnostics

AIOS provides comprehensive diagnostics to monitor framework health and performance.

-- Get framework metadata
local meta = AIOS:GetMeta()
print("AIOS Version:", meta.version)

-- Get Lean optimization metrics
local metrics = AIOS.Lean:getMetrics()
print("Memory saved:", metrics.memorySaved, "bytes")

-- Get pool statistics
local pools = AIOS.Lean:getPoolStats()
print("Active pools:", pools.totalPools)

Performance Tips

🎯 Always Use WithLean: For any temporary table operations, use WithLean instead of creating new tables. It's faster and prevents memory fragmentation.
🎯 Intern Repeated Strings: Use stringManager:get() for any strings that appear multiple times in your code (UI labels, messages, etc.).
🎯 Lazy Load Heavy Data: Defer loading of large configuration tables or rarely-used data with lazyLoad().
🎯 Recycle Responsibly: Always call recycleTable() when done with pooled tables, or use WithLean for automatic management.

Advanced Usage

Custom Service Development

-- Define a sophisticated service
AIOS.ServiceRegistry:Define("AdvancedMath", "2.0.0", function()
    local math = {}
    
    function math:CalculateStats(data)
        return self:WithLean(function(temp)
            -- Complex calculations with pooled memory
            for i, value in ipairs(data) do
                temp[i] = self:ComplexOperation(value)
            end
            return self:AnalyzeResults(temp)
        end)
    end
    
    return math
end, {
    interface = { "CalculateStats" },
    singleton = true,
    lazy = false
})

SignalHub for Internal Communication

-- Component A: Send signals
function ComponentA:DataUpdated()
    AIOS.SignalHub:Emit("DataUpdated", self.data)
end

-- Component B: Listen for signals
function ComponentB:OnInitialize()
    self.listener = AIOS.SignalHub:Listen("DataUpdated", function(data)
        self:HandleNewData(data)
    end)
end

-- One-time listener
AIOS.SignalHub:Once("InitialLoadComplete", function()
    print("Initial load finished!")
})

Compatibility

AIOS Core is designed to work across multiple WoW versions with a single codebase.

Retail

Fully compatible with WoW Retail 11.x and 12.x

12.0.0 11.0.0

Classic Era

Optimized for Classic Era 1.15.x

1.15.7

MoP Classic

Compatible with Mists of Pandaria Classic

5.4.8

WotLK Classic

Works with Wrath of the Lich King Classic

3.4.3

Troubleshooting

Common Issues

❌ Plugin not initializing: Ensure AIOS addon is installed and enabled in your addons list. AIOS must be loaded before any plugins that depend on it.
❌ Memory leaks: Always use WithLean or manually recycle tables obtained via getTable().
❌ Service not found: Check that services are defined before being accessed, or use dependency arrays in plugin registration.

License & Attribution

MIT License - © 2025 Poorkingz

AIOS Core is open source and free to use in any World of Warcraft addon project.

Attribution is appreciated but not required.