Lua macro compatibility

Compatibility helpers let existing Luraph- and Centurion-style source compile without shipping development shims in the protected program.

Compatibility table

MacroKindBehavior
LPH_OBFUSCATEDValueResolves to true in protected output.
LPH_LINEValueResolves to the original source line.
LPH_VERSIONValueLua v2 compatibility value; resolves to 15.
LPH_ENCSTR / LPH_STRENCValue wrapperPreserves the wrapped string value.
LPH_ENCNUM / LPH_NUMENCValue wrapperPreserves the wrapped number value.
LPH_ENCBUF / LPH_BUFENCValue wrapperLua v2 buffer compatibility; returns a Roblox buffer when available.
LPH_NO_VIRTUALIZEFunction wrapperKeeps one constant function on the native path.
LPH_NO_UPVALUESFunction wrapperSupported by the Lua engine except in FiveM mode.
LPH_JIT / LPH_JIT_MAXFunction wrapperAccepted aliases that preserve the wrapped function.
LPH_CRASHControlStops protected execution with a runtime error.
LPH_PRECHECKValidationLua v2 precheck helper; can compare a returned value or table.
LPH_STACKALLOCAllocationLua v2 compatibility helper for a bounded table-like stack.
CTN_* aliasesCenturionLINE, 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)
end
local native = LPH_NO_VIRTUALIZE(function(value)
    return value * 2
end)

if LPH_OBFUSCATED then
    print(LPH_ENCSTR("protected"), native(4), LPH_LINE)
end

Centurion-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) end
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) end