An extension that allows you to convert your MTA:SA source files (.lua) into Lua bytecode files (.luac) easily!
Client scripts are downloaded and executed on players’ computers, giving them access to the source code. This can lead to misuse or theft of your scripts. Compiling these scripts adds an extra layer of security, making it harder for others to reverse-engineer your code, though it won’t completely prevent it.
We do not store users resource source codes. When you compile your Lua scripts, the source code is uploaded directly to the official Multi Theft Auto (MTA) compiler website and downloaded back after processing. For more details, please refer to the MTA Lua Compilation API Wiki.
Launch VS Code Quick Open (Ctrl+P), paste the following command and press enter.
ext install ihaswn.mtasa-lua-compiler
- Open a
.luafile in the editor or select a.luafile in the Explorer. - Right-click on the file and select Compile (.luac) from the context menu OR use the key bind CTRL+SHIFT+B when the script is open and is on the active editor.
- Once the conversion is complete, a
.luacfile will be generated in the same directory.
- Ensure you have a
meta.xmlfile that lists all the client scripts you want to compile. - Right-click on the meta.xml and select Compile All Client Scripts (.luac) from the context menu.
- The proccess will read the
meta.xmlfile, compile all specified client scripts (client/shared), and generate corresponding.luacfiles in their respective directories. You can also choose to update meta.xml to include the .luac files instead of .lua at the end of the process, for scripts that are already are included as.luacextension will look for their .lua file and re-compile them aswell.
You can use the following key bindings to quickly access the commands:
- Compile (.luac):
- Key Binding:
Ctrl + Shift + B - Condition: When the editor text is focused and the file extension is
.lua.
- Key Binding:
- Visual Studio Code (version 1.50.0 or later)
- Internet connection (for API access)
You can customize the following settings in your extension settings:
- Lua Compiler Settings:
-
Obfuscation Level:
- Key:
mtasa_luac.obfuscate - Type: String
- Options:
0: No obfuscation1: Some obfuscation2: More obfuscation3: Even more obfuscation
- Default:
0 - Description: Select the level of obfuscation to apply to your compiled Lua scripts.
- Key:
-
Use Proxy:
- Key:
mtasa_luac.use_proxy - Type: Boolean
- Default:
true - Description: Use machine proxy for Axios requests.
- Key:
-
- The conversion relies on an external API. If the API is down or unreachable, the conversion will fail.
