Skip to content

Macros

Compile-time values, literal tags, function directives, and source controls. Each entry states whether its runtime behavior is active or only recorded as compiler metadata.

Quick Reference

MacroTypePurpose
FLARE_OBFUSCATEDcompile-time valueUse different code paths in development and protected builds. (debug)
FLARE_LINEcompile-time valueEmbed the original source line in logs or diagnostics. (debug)
FLARE_CRASH()direct callStop the current thread when a guarded failure path is reached. (destructive)
FLARE_ENCSTR("literal")string literal wrapperProtect one string literal with a site-unique contextual constant record. (security)
FLARE_ENCNUM(123)number literal wrapperProtect one numeric literal with a site-unique contextual constant record. (security)
FLARE_PROTECT(literal)literal wrapperApply ENCSTR or ENCNUM protection according to the literal type. (security)
FLARE_ENCFUNC(function(...) ... end)function literal wrapperTag a function for a future encrypted-function backend. (security)
FLARE_FORCE_VM(function(...) ... end)function routing wrapperRequest VM treatment for one function when per-function routing is available. (security)
FLARE_NO_VIRTUALIZE(function(...) ... end) / FLARE_NO_VM(...) function routing wrapperRequest a faster normal function for code where speed matters more than VM protection. (unprotected)
FLARE_FORCE_NATIVE(function(...) ... end)function routing wrapperUse an explicit native-path request for one function. (performance)
FLARE_JIT(function(...) ... end)hot-path wrapperMark a frequently executed function as speed-priority code. (performance)
FLARE_JIT_MAX(function(...) ... end)hot-path wrapperRequest the strongest speed priority for an extremely hot function. (performance)
FLARE_SENSITIVE(function(...) ... end)security-tier wrapperMark logic such as license checks, integrity checks, or key derivation for stronger treatment. (security)
FLARE_NO_UPVALUES(function(...) ... end)compile-time function assertionRequire a self-contained function that does not capture locals from an outer scope. (security)
FLARE_NO_INLINE(function(...) ... end)layout wrapperRequest that a function remain separate instead of being merged into its caller. (security)
FLARE_INLINE(function(...) ... end)layout wrapperRequest that a tiny helper be merged into its caller to remove call overhead. (performance)
FLARE_COLD(function(...) ... end)layout wrapperMark a function that is rarely executed, usually an error or fallback path. (performance)
FLARE_ASSERT(condition[, message])guard callCompile to a normal assert while keeping a recognizable source macro. (debug)
--!flare keep-nextsource directiveKeep the next local or function name unchanged. (compatibility)
--!flare strip-nextsource directiveRemove the next non-empty single source line from the protected build. (debug)
FLARE_DEV_ONLY(function(...) ... end)function wrapperReplace a development-only function body with an empty no-op function. (compatibility)

Directive only

The compiler validates the macro and records metadata, but the dedicated per-function or protected-operand backend is not active yet. It does not currently add the advertised runtime effect.

Development Stubs

Development stubs

Use these passthrough definitions when running unobfuscated source. Protected builds replace or remove the macros.

stubs

lua
local FLARE_OBFUSCATED = false
local FLARE_LINE = -1

local function passthrough(value) return value end
local function functionMarker(fn)
  assert(type(fn) == "function", "expected function")
  return fn
end

local FLARE_ENCSTR = passthrough
local FLARE_STRENC = passthrough
local FLARE_ENCNUM = passthrough
local FLARE_NUMENC = passthrough
local FLARE_PROTECT = passthrough
local FLARE_ENCFUNC = functionMarker
local FLARE_FUNCENC = functionMarker
local FLARE_FORCE_VM = functionMarker
local FLARE_NO_VIRTUALIZE = functionMarker
local FLARE_NO_VM = functionMarker
local FLARE_FORCE_NATIVE = functionMarker
local FLARE_JIT = functionMarker
local FLARE_JIT_MAX = functionMarker
local FLARE_SENSITIVE = functionMarker
local FLARE_NO_UPVALUES = functionMarker
local FLARE_NO_INLINE = functionMarker
local FLARE_INLINE = functionMarker
local FLARE_COLD = functionMarker

local function FLARE_CRASH() error("FLARE_CRASH", 0) end
local function FLARE_ASSERT(condition, message)
  assert(condition, message)
end
local function FLARE_DEV_ONLY(fn) return fn end

-- Deprecated compatibility names:
local FLARE_ENC_STRING = passthrough
local FLARE_ENC_NUM = passthrough

Macro Details

FLARE_OBFUSCATED

Use different code paths in development and protected builds.

Syntax: FLARE_OBFUSCATED

Do this

lua
if FLARE_OBFUSCATED then
  enableProtectedChecks()
else
  enableDeveloperLogging()
end

Not this

lua
local text = "FLARE_OBFUSCATED" -- strings are unchanged
local field = object.FLARE_OBFUSCATED -- field access is unchanged

Notes

The bare identifier becomes true during obfuscation. The development SDK exposes false.

FLARE_LINE

Embed the original source line in logs or diagnostics.

Syntax: FLARE_LINE

Do this

lua
warn("Validation failed near line", FLARE_LINE)

local function check()
  return FLARE_LINE
end

Not this

lua
FLARE_LINE(1) -- arguments are not accepted

Notes

Each occurrence becomes its own positive line number before later transforms. FLARE_LINE() is accepted for compatibility, but the bare form is preferred.

FLARE_CRASH()

Stop the current thread when a guarded failure path is reached.

Syntax: FLARE_CRASH()

Do this

lua
if not integrityValid then
  FLARE_CRASH()
end

Not this

lua
local crash = FLARE_CRASH -- not a function value
FLARE_CRASH("reason") -- no arguments

Notes

The call becomes error("FLARE_CRASH", 0).

FLARE_ENCSTR("literal")

Protect one string literal with a site-unique contextual constant record.

Syntax: FLARE_ENCSTR("string literal")

Do this

lua
local endpoint = FLARE_ENCSTR("https://api.example.com")
local header = FLARE_STRENC("X-Access-Token")

Not this

lua
local endpoint = FLARE_ENCSTR(config.url) -- literal required
local mixed = FLARE_ENCSTR("a" .. "b") -- expression rejected

Notes

Each macro site receives its own record, one of four share-reconstruction variants, on-demand decoding, and no persistent plaintext cache. Maximum additionally binds block-local records to execution context. The plaintext still exists briefly at use. FLARE_ENC_STRING is deprecated.

FLARE_ENCNUM(123)

Protect one numeric literal with a site-unique contextual constant record.

Syntax: FLARE_ENCNUM(numberLiteral)

Do this

lua
local productId = FLARE_ENCNUM(123456789)
local multiplier = FLARE_NUMENC(-2.5)

Not this

lua
local productId = FLARE_ENCNUM(config.productId)
local value = FLARE_ENCNUM(base + 1)

Notes

The numeric text is reconstructed only when consumed, converted back to a number, and is not kept in the persistent constant cache. FLARE_ENC_NUM is deprecated.

FLARE_PROTECT(literal)

Apply ENCSTR or ENCNUM protection according to the literal type.

Syntax: FLARE_PROTECT(stringOrNumberLiteral)

Do this

lua
local name = FLARE_PROTECT("internal-name")
local id = FLARE_PROTECT(88421)

Not this

lua
local tableValue = FLARE_PROTECT({ 1, 2, 3 }) -- unsupported type

Notes

This is a convenience wrapper and uses the same runtime backend and cost as ENCSTR or ENCNUM.

FLARE_ENCFUNC(function(...) ... end)

Tag a function for a future encrypted-function backend.

Syntax: FLARE_ENCFUNC(function(...) ... end [, keyLiteral])

Do this

lua
local verify = FLARE_ENCFUNC(function(key)
  return key ~= nil and #key > 8
end)

verify(userKey)

Not this

lua
local verify = FLARE_ENCFUNC(existingFunction) -- literal function required

Notes

The wrapper returns the same function and never calls it. Metadata is recorded, but encrypted function bodies are not implemented yet.

FLARE_FORCE_VM(function(...) ... end)

Request VM treatment for one function when per-function routing is available.

Syntax: FLARE_FORCE_VM(function(...) ... end)

Do this

lua
local verify = FLARE_FORCE_VM(function(key)
  return validateKey(key)
end)

local result = verify(userKey)

Not this

lua
FLARE_FORCE_VM(FLARE_NO_VM(function() end)) -- conflicting paths

Notes

The wrapper returns the same function. The compiler records exec = vm and validates conflicts, but current builds do not route this function differently yet.

FLARE_NO_VIRTUALIZE(function(...) ... end) / FLARE_NO_VM(...)

Request a faster normal function for code where speed matters more than VM protection.

Syntax: FLARE_NO_VM(function(...) ... end)

Do this

lua
local distanceSquared = FLARE_NO_VM(function(a, b)
  local delta = a - b
  return delta * delta
end)

Not this

lua
local verifyLicense = FLARE_NO_VM(function(key)
  return validateSecret(key)
end) -- sensitive logic should stay protected

Notes

The request is recorded, but current builds do not route the function differently yet. Once active, the marked function will be faster and less protected.

FLARE_FORCE_NATIVE(function(...) ... end)

Use an explicit native-path request for one function.

Syntax: FLARE_FORCE_NATIVE(function(...) ... end)

Do this

lua
local transform = FLARE_FORCE_NATIVE(function(vector)
  return vector.X * 2, vector.Y * 2
end)

local x, y = transform(input)

Not this

lua
local verify = FLARE_FORCE_NATIVE(function(key)
  return validateKey(key)
end) -- trades protection for speed

Notes

Current builds record the same native-path metadata as NO_VM. The stronger required-native guarantee is not implemented yet.

FLARE_JIT(function(...) ... end)

Mark a frequently executed function as speed-priority code.

Syntax: FLARE_JIT(function(...) ... end)

Do this

lua
local update = FLARE_JIT(function(dt)
  position += velocity * dt
end)

Not this

lua
FLARE_JIT(FLARE_COLD(function() end)) -- hot and cold conflict

Notes

Use it for loops or callbacks that run constantly. The compiler records the request, but per-function JIT/native routing is not active yet.

FLARE_JIT_MAX(function(...) ... end)

Request the strongest speed priority for an extremely hot function.

Syntax: FLARE_JIT_MAX(function(...) ... end)

Do this

lua
local integrate = FLARE_JIT_MAX(function(state, dt)
  return stepPhysics(state, dt)
end)

Not this

lua
FLARE_JIT_MAX() -- function literal required

Notes

It is a stronger request than FLARE_JIT. Current builds record it but do not change emission yet.

FLARE_SENSITIVE(function(...) ... end)

Mark logic such as license checks, integrity checks, or key derivation for stronger treatment.

Syntax: FLARE_SENSITIVE(function(...) ... end)

Do this

lua
local verifyLicense = FLARE_SENSITIVE(function(key)
  local normalized = normalizeKey(key)
  return compareKey(normalized)
end)

if verifyLicense(userKey) then
  startProtectedCode()
end

Not this

lua
FLARE_SENSITIVE(FLARE_JIT(function() end)) -- security and speed paths conflict

Notes

The wrapper returns the same function and records VM plus sensitive-tier metadata. The stronger per-function backend is not connected yet.

FLARE_NO_UPVALUES(function(...) ... end)

Require a self-contained function that does not capture locals from an outer scope.

Syntax: FLARE_NO_UPVALUES(function(...) ... end)

Do this

lua
local square = FLARE_NO_UPVALUES(function(value)
  local result = value * value
  return result
end)

Not this

lua
local multiplier = 2
local scale = FLARE_NO_UPVALUES(function(value)
  return value * multiplier -- captures outer local multiplier
end)

Notes

Parameters, locals created inside the function, and globals are allowed. Compilation fails only when the function closes over an enclosing local.

FLARE_NO_INLINE(function(...) ... end)

Request that a function remain separate instead of being merged into its caller.

Syntax: FLARE_NO_INLINE(function(...) ... end)

Do this

lua
local boundary = FLARE_NO_INLINE(function()
  return verifyRuntimeState()
end)

Not this

lua
FLARE_NO_INLINE(FLARE_INLINE(function() end)) -- conflicting hints

Notes

Keeping a function separate can preserve a useful code boundary. The current compiler records the hint, but no inliner consumes it yet.

FLARE_INLINE(function(...) ... end)

Request that a tiny helper be merged into its caller to remove call overhead.

Syntax: FLARE_INLINE(function(...) ... end)

Do this

lua
local add = FLARE_INLINE(function(a, b)
  return a + b
end)

Not this

lua
FLARE_INLINE("not a function")

Notes

Use it only for very small helpers. The current compiler records the hint, but no inliner consumes it yet.

FLARE_COLD(function(...) ... end)

Mark a function that is rarely executed, usually an error or fallback path.

Syntax: FLARE_COLD(function(...) ... end)

Do this

lua
local reportFailure = FLARE_COLD(function(message)
  warn(message)
end)

Not this

lua
FLARE_COLD(FLARE_JIT(function() end)) -- rare and hot conflict

Notes

A future layout stage can optimize this path for size instead of speed. Current builds only record the hint.

FLARE_ASSERT(condition[, message])

Compile to a normal assert while keeping a recognizable source macro.

Syntax: FLARE_ASSERT(condition[, message])

Do this

lua
FLARE_ASSERT(type(config) == "table", "missing config")

Not this

lua
FLARE_ASSERT() -- condition required

Notes

The current output uses assert(condition, message).

--!flare keep-next

Keep the next local or function name unchanged.

Syntax: --!flare keep-next

Do this

lua
--!flare keep-next
local PublicCallback = function(payload)
  return payload
end

Not this

lua
--!flare keep-next
print("no name here")
local PublicCallback = function() end

Notes

Place the directive immediately before the declaration whose name must stay stable.

--!flare strip-next

Remove the next non-empty single source line from the protected build.

Syntax: --!flare strip-next

Do this

lua
--!flare strip-next
print("development trace")

Not this

lua
--!flare strip-next
if debugMode then
  print("multi-line block")
end

Notes

Use it only for one-line development statements. Block-opening lines are rejected.

FLARE_DEV_ONLY(function(...) ... end)

Replace a development-only function body with an empty no-op function.

Syntax: FLARE_DEV_ONLY(function(...) ... end)

Do this

lua
local debugDump = FLARE_DEV_ONLY(function()
  print("debug state")
end)

Not this

lua
local requiredValue = FLARE_DEV_ONLY(function()
  return calculateRequiredValue()
end) -- protected build receives a no-op function

Notes

Do not depend on its return value in protected builds.

FlareKey documentation