Zync AuthDocumentationDashboard

Writing scripts

Luraph migration

Luraph v14 macro calls and their Zync equivalents.

Upload your original source. Keep the names below or replace them with Zync equivalents. Global development shims inside if not LPH_OBFUSCATED then or its Zync equivalent are removed. The LPH prefix is reserved: do not use it for local variables or parameters.

LuraphLPH_OBFUSCATEDZyncZYNC_OBFUSCATED

True in protected builds. Development shims inside if not LPH_OBFUSCATED then are removed.

LuraphLPH_LINEZyncZYNC_LINE

The original source line.

LuraphLPH_ENCSTR / LPH_STRENCZyncZYNC_ENCSTR / ZYNC_STRENC

Adds a separate ChaCha20 encryption layer to one constant string. Binary escapes and empty strings are preserved.

LuraphLPH_ENCNUM / LPH_NUMENCZyncZYNC_ENCNUM / ZYNC_NUMENC

Encrypts one constant number as its exact 64-bit value, including negative zero. Luau uses doubles; Lua 5.3 integer types are not available.

LuraphLPH_JIT / LPH_JIT_MAXZyncZYNC_JIT / ZYNC_JIT_MAX

Compiles an inline function for native execution after delivery, avoiding interpreter overhead. JIT_MAX also folds exact constant arithmetic. Its source is encrypted with a build-generated key.

LuraphLPH_NO_VIRTUALIZEZyncZYNC_NO_VIRTUALIZE

Compiles an inline function as native Lua after delivery. Captured variables remain shared with the protected script.

LuraphLPH_NO_UPVALUESZyncZYNC_NO_UPVALUES

Returns a native proxy with no lexical upvalues; its function body stays virtualized. A private environment bridge forwards calls and captured variables.

LuraphLPH_ENCFUNC / LPH_FUNCENCZyncZYNC_ENCFUNC / ZYNC_FUNCENC

Encrypts an inline function with a constant 64-character hexadecimal key. A runtime key decrypts and loads the function; the encryption key is removed from the protected program. Wrong keys fail before loading.

LuraphLPH_CRASHZyncZYNC_CRASH

Invalidates the protected VM context and raises an error. Catching it does not let virtualized code resume; other closures in that context also stop.

Native callbacks

local total = 0
local callback = ZYNC_NO_UPVALUES(function(amount)
    total += amount
    return total
end)

JIT, JIT_MAX, No virtualize, No upvalues, and Encfunc require direct calls with inline function literals and client loadstring, getfenv, and setfenv support. They return a callable function; they do not invoke it. Native signatures, shared captured variables, yields, and multiple return values are preserved. No upvalues uses a private environment bridge with no lexical captures on the returned proxy; its original function stays virtualized. Unmarked functions remain virtualized.

Virtualized functions have interpreter frames and upvalues. Code that scans all runtime functions or relies on exact native stack metadata can observe those differences. Selecting a function only by its number of upvalues can select an interpreter function.

Encrypted functions

local runtimeKey = fetchFunctionKeyFromYourServer()
local protected = LPH_ENCFUNC(function(value)
    return value + 1
end, "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", runtimeKey)
print(protected(2))

Use your own random 256-bit key. The key shown here is an example. Fetch the matching decryption key at runtime; do not repeat the encryption key in another string constant, including literal text in Luau backticks. The key argument must be a constant hexadecimal string, and the decryption argument must be a runtime expression. Constant backtick expressions are rejected as decryption keys. Wrong or malformed keys raise an error, which you can handle with pcall.

Compile-time checks

Encstr takes exactly one string literal. Encnum takes exactly one numeric literal, optionally negative. Function macros take one inline function, except Encfunc, which takes three arguments. Macro values such as LPH_LINE and LPH_OBFUSCATED cannot be called. Unknown LPH names, assignments to macros outside removed shims, and invalid arguments fail during compilation.

ZYNC_INTERNAL_CRASH and ZYNC_INTERNAL_STREAM are reserved global names for generated macro capabilities. Using either as a global in uploaded source fails compilation. Locals, table fields, comments, and strings with those names remain ordinary Lua values. Use the public ZYNC_CRASH and encryption macros instead of calling internal capabilities.

LPH_OBFUSCATED conditions and unreachable branches are removed while retaining branch scopes and side effects. LPH_LINE reports the original source line. LPH_CRASH stops the protected execution context without terminating the host application; standalone expanded source falls back to an error. Native code already executing under a caught error may run until it returns to the VM.

Interface references: Luraph v14 macros and the v14 Macro SDK.