Macros

Compile-time macros and SDK setup.

SDK setup

if not LUAQ_OBFUSCATED then
    loadstring(game:HttpGet("https://luaq-sdk.luaq.lol"))()
end

Add this once at the top of your original Roblox script to use macros before obfuscation. Not required in obfuscated output. For Luau CLI or Lua 5.2, use local stubs.

LUAQ_OBFUSCATED

A boolean that is true after obfuscation. Use it to skip SDK setup or debug code. Not a license check.

if not LUAQ_OBFUSCATED then
    print("Testing the original script")
end

print("Script started")

LUAQ_NO_VIRTUALIZE(function)

Compiles a function natively instead of virtualizing it. Useful for frequently called functions.

local elapsed = 0

local update = LUAQ_NO_VIRTUALIZE(function(deltaTime)
    elapsed += deltaTime
    return elapsed
end)

print(update(0.016))

Pass a function literal, not a variable. Nested functions remain native; captures are preserved. Native code remains visible in the output. Supports CONTROL_FLOW.

LUAQ_PRECHECK(check, expectedKey)

Runs before the main program. The returned integer or integer array must match the expected key to unlock the program.

LUAQ_PRECHECK(function()
    return bit32.bxor(0x1200, 0x34)
end, 0x1234)

print("Startup check passed")
  • Use a parameterless anonymous function with no varargs or external local captures.
  • The expected key must be an integer literal or an array of 1 to 256 integer literals, within ±9,007,199,254,740,991. No expressions, variables or keyed fields.
  • Up to 256 checks per file; each runs once in source order, even if declared inside a conditional or function. Use as a statement.
  • Global helpers must exist before startup. Checks and nested functions use FULL; SWIFT and nested prechecks are rejected.
  • A wrong result or error stops startup. A constant return alone is not a license check.

LUAQ_LINE

The line number in the original source. A value, not a function call.

local checkpointLine = LUAQ_LINE
print("Checkpoint", checkpointLine)

LUAQ_CRASH()

Stops the protected program and invalidates its VM and native callbacks. Takes no arguments.

local function verifyAccess(allowed)
    if not allowed then
        LUAQ_CRASH()
    end
    print("Access accepted")
end

verifyAccess(true)

Limits

  • Use exact macro names and do not shadow them.
  • Keep SDK loading inside if not LUAQ_OBFUSCATED then. Do not substitute an infinite-loop crash stub.
  • Maximum source size: 3,000,000 bytes.
  • See Attributes for function and loop transformations.