Language compatibility
Lua 5.1 vs Luau
Luau builds on Lua 5.1, but source portability and runtime compatibility are separate questions. A file can parse successfully and still fail on its first host-specific call.
Luau syntax that Lua 5.1 will reject
These are language-level differences. A stock Lua 5.1 parser rejects Luau's compound assignment, continue, type annotations and backtick interpolation. If you move code between runtimes, do not rely on a filename extension to identify the language.
| Luau source | Portable Lua 5.1 approach |
|---|---|
total += value | total = total + value |
continue in a loop | Put the remaining loop body in an if block. |
local name: string | Remove the annotation; validate values at runtime if needed. |
`Hello {name}` | "Hello " .. name |
For example, this Luau loop skips negative values:
local total = 0
for _, value in ipairs(values) do
if value < 0 then continue end
total += value
end
In Lua 5.1, use an explicit condition instead:
local total = 0
for _, value in ipairs(values) do
if value >= 0 then
total = total + value
end
end
The two loops express the same intention for this example. That does not make an entire Roblox script portable; the host APIs it calls still matter.
Runtime differences
Roblox APIs such as game, Instance.new and task.wait depend on the Roblox environment. A standalone Lua runtime will not provide them. LuaJIT FFI, MoonLoader event hooks and native modules are different host capabilities. A language parser cannot create those capabilities for you.
Test a small probe in the environment you intend to support. For example, print(type(game), type(task)) tells you whether those globals are present, but it does not prove every API call is safe. Avoid silently substituting empty tables for missing host objects: that can hide a compatibility error until much later.
How hide.lat treats the difference
The obfuscator's primary target is Luau. Its parser handles supported Luau syntax and removes type annotations from generated executable code. A Lua 5.1 script that uses the shared subset may build, but we do not claim blanket Lua 5.1 or LuaJIT compatibility. The output needs to be tested in the same runtime, loader and library set as the original.
Before you move or protect a script
- Identify the actual interpreter and host application, not just the
.luaor.luausuffix. - Run the source through Lua Script Doctor to catch known syntax and API patterns.
- Run the original in the target runtime and record its output, callbacks and errors.
- Make a protected build, then repeat the same test with the same inputs and versions.
For Roblox, use the Roblox release checklist. For MoonLoader, follow the LuaJIT and FFI checks. See all guides for the full workflow.
Reviewed on .