Legacy Macros Overview (CRX / LPH)
Deprecated — Legacy Cortex Engine Only: CRX_* and LPH_* macros are strictly supported for the Legacy (Cortex) virtualization preset and backward compatibility. For standard production builds, LuaProtect uses the Centurion obfuscation engine (v6.3). You must use Centurion macros (CTN_*) from their documentation instead.
Overview
When compiling scripts targeting the legacy Cortex virtualization engine, compile-time macros allow you to control symbol virtualization, force Mixed Boolean-Arithmetic (MBA) protection on numeric constants, dynamically encrypt sensitive string literals, and bypass virtual machine interpretation for high-frequency performance loops.
Supported Legacy Macros
- CRX_OBFUSCATED (Form: expression; alias: LPH_OBFUSCATED) — Injected boolean constant. Evaluates to true when compiled into bytecode, and nil/false in un-obfuscated testing environments.
- CRX_CRASH() (Form: call; alias: LPH_CRASH) — Emits a deliberate fatal runtime termination error to crash execution on tamper detection.
- CRX_NO_VIRTUALIZE(fn) (Form: call; alias: CRX_JIT_MAX, LPH_NO_VIRTUALIZE, LPH_JIT_MAX) — Emits the function as a native Luau closure (OP_NATIVE) with an environment proxy, bypassing VM bytecode interpretation for 60 FPS performance.
- CRX_ENCRYPT_FUNCTION(fn) (Form: call; alias: CRX_ENCFUNC, LPH_ENCFUNC) — Recursively inspects the AST of the target function and encrypts all enclosed string and constant literals.
- CRX_ENCRYPT_STRING("...") (Form: call; alias: CRX_ENCSTR, LPH_ENCSTR, LPH_ENCRYPT_STRING) — Dynamic per-access string decryption. The plaintext literal is stripped from the static constant pool and decrypted at runtime.
- CRX_ENCRYPT_NUMBER(...) (Form: call; alias: CRX_ENCNUM, LPH_ENCNUM, LPH_ENCRYPT_NUMBER) — Forces unconditional Mixed Boolean-Arithmetic (MBA) polynomial transformation on the wrapped number literal prior to bytecode generation.
Migrating to Centurion (Normal Builds)
For normal and modern production builds, LuaProtect compiles scripts using the Centurion engine. To ensure compatibility with standard builds, migrate from legacy macros to the corresponding Centurion macros: replace CRX_OBFUSCATED with CTN_OBFUSCATED, CRX_CRASH with CTN_CRASH, CRX_NO_VIRTUALIZE with CTN_NO_VIRTUALIZE, CRX_ENCRYPT_STRING with CTN_ENCRYPT_STRING, and CRX_ENCRYPT_NUMBER with CTN_ENCRYPT_NUMBER.