AEGIS

AEG_* macros

Marker functions that give you fine-grained control over what gets protected.

What are macros?

Aegis ships its own macro family (modeled on Luraph's LPH_* macros). Macros are marker functions: Aegis never renames them and always protects their string/number arguments. You can call them freely - the runtime stubs below make them safe no-ops during local development.

The most useful pair for performance is AEG_NO_OBFUSCATE and AEG_NO_VIRTUALIZE — mark rendering loops, UI code and hot paths so they run at full speed. See the performance guide.

Runtime stubs (safe no-op definitions)
-- Paste at the top of your source (or include aegis.lua):
local function AEG_OBFUSCATED() return nil end
local function AEG_ENCSTR(s) return s end
local function AEG_ENCNUM(n) return n end
local function AEG_ENCBUF(buf) return buf end
local function AEG_OPAQUE(x) return x end
local function AEG_CRASH() error("unreachable", 2) end
local function AEG_STACKALLOC(n) return n or 0 end
local function AEG_PRECHECK(c, m) if not c then error(m or "precheck", 2) end return true end
local function AEG_REWRITE() return nil end
local function AEG_LINE(n) return n end
local function AEG_NO_VIRTUALIZE(fn) return fn end
local function AEG_NO_OBFUSCATE(x) return x end

Reference

AEG_OBFUSCATED()

AEG_OBFUSCATED()

Marks a scope or function for full protection. A compatibility marker - with Aegis everything is already protected by default.

AEG_ENCSTR("text")

local k = AEG_ENCSTR("secret")

Explicitly marks a string literal for encryption.

AEG_ENCNUM(n)

local x = AEG_ENCNUM(1337)

Explicitly marks a number for obfuscation.

AEG_ENCBUF(buf)

local b = AEG_ENCBUF(bytes)

Explicitly marks a byte buffer for protection.

AEG_OPAQUE(x)

local v = AEG_OPAQUE(input)

Returns an opaque value the compiler cannot constant-fold away.

AEG_CRASH()

AEG_CRASH()

Stops execution if reached - useful as a dead-code trap.

AEG_STACKALLOC(size)

AEG_STACKALLOC(16)

Hints the obfuscator to reserve a scratch stack frame.

AEG_PRECHECK(cond, msg)

AEG_PRECHECK(x > 0, "bad x")

Assertion helper that errors when the condition is false.

AEG_REWRITE()

AEG_REWRITE()

Requests a control-flow rewrite of the enclosing scope.

AEG_LINE(n)

AEG_LINE(42)

Source line marker (compatibility no-op).

AEG_NO_VIRTUALIZE(fn)

AEG_NO_VIRTUALIZE(function() ... end)

Prevents virtualization of the marked function. Use on code that runs every frame - see the performance guide.

AEG_NO_OBFUSCATE(x)

AEG_NO_OBFUSCATE(value)

Prevents any obfuscation of the marked value. Use on rendering/UI code and large third-party libraries.

Need the full file? Download aegis.lua and include it at the top of your source.