Precompile scripts

From Pragma
Jump to: navigation, search

Description

You can pre-compile your Lua-files for faster loading and obfuscation, however this will usually not decrease the file-size, or the execution time. (You can find more information about it here.)
To pre-compile a Lua-script, simply run "lua_compile path/to/script.lua" from the console, with the path being relative to the lua/-directory.
This will generate a new file with the same name as the original Lua-script, but with the ".clua"-extension.
The compilation will also automatically strip all debug information from the script, which means error-messages thrown by the script will be useless!

If a pre-compiled version of a script exists, functions like include will load the pre-compiled script automatically

Example

lua_compile gui/skin_default.lua

This will pre-compile the script and save it as "lua/gui/skin_default.clua".