Skip to main content
Soteria exposes a set of compile-time macros that let you query and control the runtime environment directly from your Lua scripts.

SOTR_OBFUSCATED

Type: boolean Returns true if the current script is obfuscated, and false otherwise. Useful for toggling debug behavior or hiding sensitive logic paths in plain builds.
SOTR_OBFUSCATED
boolean
true when obfuscation is active, false when running unprotected.
if SOTR_OBFUSCATED then
    print("Obfuscated by Soteria")
end

SOTR_LINE

Type: number Expands to the current source line number at the point of use. Helpful for logging, error reporting, and runtime diagnostics without relying on debug.traceback.
SOTR_LINE
number
The line number in the source file where the macro is referenced.
local function assert_eq(a, b)
    if a ~= b then
        error("Assertion failed at line " .. SOTR_LINE .. ": expected " .. tostring(b) .. ", got " .. tostring(a))
    end
end

assert_eq(1 + 1, 2)

SOTR_KILL

Type: () → never Immediately crashes the Lua VM. Use this as a hard tripwire — placing it behind anti-tamper checks, license validation, or integrity guards ensures the process cannot continue if the condition is violated.
This is irreversible. Once called, the VM is terminated and no further code executes. Do not use in hot paths or without a deliberate condition guard.
SOTR_KILL
function
Calling this function crashes the VM immediately with no recovery.
local expired = true
if expired then
  SOTR_KILL()
end

SOTR_GUID

Type: string Expands to a random hex string generated once at obfuscation time. Every obfuscation run produces a different value, but all uses of SOTR_GUID within the same run expand to the same string. Useful for unique script instance identification or anti-leak fingerprinting.
SOTR_GUID
string
A random hex identifier baked in at obfuscation time, consistent across the entire script.
local scriptId = SOTR_GUID
print("Script ID:", scriptId) --> e.g. "817d3b823e8f867"

SOTR_TIMESTAMP

Type: number Expands to the Unix timestamp of when the script was obfuscated. Useful for expiry logic, build tracking, or logging when a particular build was generated.
SOTR_TIMESTAMP
number
The Unix timestamp at the moment obfuscation was run.
local obfuscatedAt = SOTR_TIMESTAMP
local ageInDays = (os.time() - obfuscatedAt) / 86400
print(string.format("This script was obfuscated %.1f days ago", ageInDays))

SOTR_VERSION

Type: string Expands to the current Soteria obfuscator version string at the time of obfuscation. Useful for debugging, watermarking, or asserting a minimum obfuscator version at runtime.
SOTR_VERSION
string
The Soteria version string, e.g. "v1.0.0".
print("Protected with Soteria " .. SOTR_VERSION)

SOTR_ENC_STR

Type: (string) → string Encrypts a string constant at compile-time and inserts the decryption logic inline. The plaintext value is never present in the compiled output — only the encrypted form and its corresponding decryptor are embedded. Decryption happens transparently at runtime when the value is first accessed.
SOTR_ENC_STR
function
Accepts a string literal and returns the decrypted string at runtime. The original value is not present in the bytecode.
local apiKey = SOTR_ENC_STR("super-secret-key-123")
print(apiKey) --> "super-secret-key-123" (decrypted at runtime)

SOTR_ENC_NUM

Type: (number) → number Encrypts a numeric constant at compile-time. Like SOTR_ENC_STR, the original value is replaced with an encrypted representation in the compiled output and decrypted transparently at runtime. Useful for obscuring license codes, version checks, or magic constants.
SOTR_ENC_NUM
function
Accepts a number literal and returns the decrypted number at runtime. The original value is not present in the bytecode.
local licenseCode = SOTR_ENC_NUM(209715200)
if code == licenseCode then
    print("License valid")
end

SOTR_EXPOSE

Type: (function) → function Wraps a function to exclude it from virtualization. The wrapped function is compiled normally and executes at native speed, bypassing the Soteria VM layer entirely. Use this for hot paths where virtualization overhead is unacceptable.
Exposed functions receive no virtualization protection. Sensitive logic inside an exposed function can be more easily reverse engineered. Reserve this macro for performance-critical code that contains no secrets.
SOTR_EXPOSE
function
Accepts a function and returns it unvirtualized. The returned function executes outside the Soteria VM at native speed.
local multiply = SOTR_EXPOSE(function(a, b, size)
    local result = {}
    for i = 1, size do
        result[i] = {}
        for j = 1, size do
            local sum = 0
            for k = 1, size do
                sum = sum + a[i][k] * b[k][j]
            end
            result[i][j] = sum
        end
    end
    return result
end)

local out = multiply(matA, matB, 64)