SDK setup
if not LUAQ_OBFUSCATED then
loadstring(game:HttpGet("https://luaq-sdk.obfuscator.cfd"))()
endAdd 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.
Syntax
Place function attributes in a single declaration as the first executable statement of the function. Comments and type declarations may precede it.
local function calculate(value)
LUAQ_ATTRIBUTES(PACKET_SCRAMBLE, MUTATE)
local result = value * 3
return result + 2
end
print(calculate(6))Names are case-sensitive and unquoted. Ordinary function attributes do not inherit. PACKET_SCRAMBLE and MUTATE may also be used at file scope; VM is function-only, and UNROLL is loop-only. Unknown, duplicate or empty declarations are rejected, including in unused functions.
VM
Selects the VM for a function. Declare it directly inside the function body, not at file scope or between statements. Nested functions inherit the enclosing VM unless they select their own.
local function add(a, b)
LUAQ_ATTRIBUTES(VM(SWIFT))
return a + b
end
print(add(2, 3))VM options
FULL: Default VM. Prioritizes protection with full instruction checks.SWIFT: Faster execution with reduced instruction-level checking.
All virtualized code uses FULL by default. You do not need to declare FULL; use SWIFT for functions that need faster execution. Both profiles retain enabled encryption and anti-tamper checks. Native functions remain native; PRECHECK requires FULL.
CONTROL_FLOW
Transforms the control flow of a native function. Requires LUAQ_NO_VIRTUALIZE; not supported at file scope or in virtualized functions.
local total = 0
local update = LUAQ_NO_VIRTUALIZE(function(deltaTime)
LUAQ_ATTRIBUTES(CONTROL_FLOW)
if deltaTime > 0 then
total += deltaTime
end
return total
end)
print(update(0.016))Preserves captures, breaks and continues. Adds dispatcher overhead. Supports NO_UPVALUES; goto and labels are unsupported. Native code remains visible.
PACKET_SCRAMBLE
Enables eligible instruction packet fusion for virtualized code, even if disabled globally.
local function score(points, multiplier)
LUAQ_ATTRIBUTES(PACKET_SCRAMBLE)
local result = points * multiplier
return result + 5
end
print(score(8, 2))FULL can vary private-read order and packet layouts. SWIFT supports contiguous fusion without FULL-only checks. Not supported in native functions.
MUTATE
Enables opcode and operand variations on FULL instructions, even if global polymorphism is disabled.
local function choose(value, limit)
LUAQ_ATTRIBUTES(PACKET_SCRAMBLE, MUTATE)
if value > limit then
return value - limit
end
return value + limit
end
print(choose(12, 7))Virtualized functions only. Does not enable packet fusion by itself or restore FULL checks in SWIFT.
INLINE
Copies eligible virtualized function bodies into their call sites to remove call overhead.
local function add(a, b)
LUAQ_ATTRIBUTES(INLINE)
return a + b
end
print(add(3, 4))Falls back to a normal call if inlining is unsafe, such as recursion, reassignment or escaping function values. Compatible with NO_UPVALUES and VM, not CONTROL_FLOW, PACKET_SCRAMBLE or MUTATE.
NO_UPVALUES
Compatibility attribute accepted by native and virtualized functions. Currently preserves captures unchanged; it does not remove upvalues or add protection.
local total = 0
local function add(amount)
LUAQ_ATTRIBUTES(NO_UPVALUES)
total += amount
return total
end
print(add(5))UNROLL
Expands a numeric for loop at compile time. Place the declaration first inside the loop.
local values = {}
for i = 1, 4 do
LUAQ_ATTRIBUTES(UNROLL)
values[i] = i * 3
end
print(table.concat(values, ", "))- UNROLL, UNROLL() and UNROLL(true) require successful expansion; UNROLL(false) falls back to the original loop.
- Bounds and step must resolve to finite constants; step cannot be zero. Calls, globals, table lookups and reassigned locals are unsupported.
- Limit: 256 iterations and 16,384 AST nodes per loop, including nested expansion.
- Works in native and virtualized numeric for loops. Not generic for, while or repeat. Breaks, continues and captures are preserved; goto and labels are unsupported.
- Use UNROLL alone in the loop declaration. VM belongs in a function body.
local function fill(count)
local values = {}
for i = 1, count do
LUAQ_ATTRIBUTES(UNROLL(false))
values[i] = i
end
return values
end
print(#fill(4))Compatibility
| Scope | Supported attributes |
|---|---|
| Virtualized function | VM, PACKET_SCRAMBLE, MUTATE, NO_UPVALUES |
| Inline function | INLINE, NO_UPVALUES, VM |
| Native function | CONTROL_FLOW, NO_UPVALUES (VM has no effect) |
| Numeric for loop | UNROLL only |
| File scope | PACKET_SCRAMBLE, MUTATE |
| PRECHECK | FULL only; explicitly native nested helpers may use CONTROL_FLOW |