Reference / Macros
Control how individual parts of a script are protected.
Ironbrew1 macros are resolved during compilation or handled by the generated VM. They do not require a runtime library.
IB_OBFUSCATED
A boolean constant that resolves to true after Ironbrew1 processes the script. Use it to separate development and protected-build behavior.
if IB_OBFUSCATED then
print("Running under virtualization")
else
print("Running outside virtualization")
endIB_LINE
A numeric constant that resolves to the source line where it appears. It can retain useful diagnostics without hard-coding line numbers.
local function assertion(cond, msg)
if not cond then
error(msg .. " at line " .. IB_LINE)
end
endIB_NO_VIRTUALIZE
Leaves a function outside the generated VM. Reserve it for measured hot paths where virtualization overhead is unacceptable.
local hugeMathTask
IB_NO_VIRTUALIZE(function()
hugeMathTask = function(iterations)
local count = 0
for i = 1, iterations do
count = count + math.sqrt(i)
end
return count
end
end)()IB_INLINE
Requests that a small function be inlined at each call site. This removes call overhead without excluding the surrounding code from virtualization.
local mix = IB_INLINE(function(a, b, ...)
local value = (a * 33) + b
return value, ...
end)
local result, extra = mix(counter, salt, payload)IB_ENCSTR
Marks a string for protected storage so it is not emitted as an ordinary plaintext constant.
local secretString = IB_ENCSTR("super secret string")IB_CRASH
Stops the generated VM immediately. Use it when a failed authorization or integrity check must prevent all further execution.
if not whitelisted then
IB_CRASH()
end