Lua macro compatibility
Compatibility helpers let existing Luraph- and Centurion-style source compile without shipping development shims in the protected program.
Compatibility table
| Macro | Kind | Behavior |
|---|---|---|
| LPH_OBFUSCATED | Value | Resolves to true in protected output. |
| LPH_LINE | Value | Resolves to the original source line. |
| LPH_VERSION | Value | Lua v2 compatibility value; resolves to 15. |
| LPH_ENCSTR / LPH_STRENC | Value wrapper | Preserves the wrapped string value. |
| LPH_ENCNUM / LPH_NUMENC | Value wrapper | Preserves the wrapped number value. |
| LPH_ENCBUF / LPH_BUFENC | Value wrapper | Lua v2 buffer compatibility; returns a Roblox buffer when available. |
| LPH_NO_VIRTUALIZE | Function wrapper | Keeps one constant function on the native path. |
| LPH_NO_UPVALUES | Function wrapper | Supported by the Lua engine except in FiveM mode. |
| LPH_JIT / LPH_JIT_MAX | Function wrapper | Accepted aliases that preserve the wrapped function. |
| LPH_CRASH | Control | Stops protected execution with a runtime error. |
| LPH_PRECHECK | Validation | Lua v2 precheck helper; can compare a returned value or table. |
| LPH_STACKALLOC | Allocation | Lua v2 compatibility helper for a bounded table-like stack. |
| CTN_* aliases | Centurion | LINE, OBFUSCATED, CRASH, NO_VIRTUALIZE, and INLINE are translated. |
LPH_ENCFUNC and LPH_FUNCENC are not accepted by the legacy Lua engine because it does not provide runtime-key function encryption. Attribute-style Lua v2 helpers are compatibility annotations, not a claim that CodeProtect output was produced by another vendor.Luraph-style source
Macro calls can live directly in source; no production SDK file is required.
script.lua
local native = LPH_NO_VIRTUALIZE(function(value)
return value * 2
end)
if LPH_OBFUSCATED then
print(LPH_ENCSTR("protected"), native(4), LPH_LINE)
endlocal native = LPH_NO_VIRTUALIZE(function(value)
return value * 2
end)
if LPH_OBFUSCATED then
print(LPH_ENCSTR("protected"), native(4), LPH_LINE)
endCenturion-style source
Supported Centurion aliases are normalized before compilation.
script.lua
local value, line = CTN_INLINE(function()
local native = CTN_NO_VIRTUALIZE(function(value)
return value + 2
end)
return native(3), CTN_LINE
end)
if CTN_OBFUSCATED then print(value, line) endlocal value, line = CTN_INLINE(function()
local native = CTN_NO_VIRTUALIZE(function(value)
return value + 2
end)
return native(3), CTN_LINE
end)
if CTN_OBFUSCATED then print(value, line) end