Unzip the downloaded file into an arbitrary folder. This will create a single sub-folder named ulua
which contains the ULua distribution:
ulua
├── lua.cmd # LuaJIT executable for Windows.
├── lua # LuaJIT executable for OSX and Linux.
├── host
│ ├── config.lua # Global configuration (see PKG).
│ ├── init # Initialization scripts folder.
│ ├── tmp # Temporary files folder.
│ └── pkg # Downloaded packages cache folder.
├── bin
│ ├── upkg.cmd # Package manager executable for Windows.
│ ├── upkg # Package manager executable for OSX and Linux.
│ └── ... # Other executables depending on installed packages.
├── pkg # Package manager package.
└── ... # Other installed packages.
The lua
executable starts LuaJIT, the Lua manual and the LuaJIT manual document its usage:
# On Windows:
cd folder_containing_ulua/ulua
lua [options] [script [args]]
# On OSX and Linux:
cd folder_containing_ulua/ulua
./lua [options] [script [args]]
By default LuaJIT runs in 32-bit mode, to run it in 64-bit mode set the environment variable BIT=64
:
set BIT=64 # On Windows.
export BIT=64 # On OSX and Linux.
On Linux, if LuaJIT 32-bit is executed on a distribution lacking the 32-bit C runtime, this will result in a
meaningless error such as luajit: command not found
. Either launch LuaJIT in 64-bit mode or install the
required Linux libraries. OSX 10.15 (Catalina) similarly does not support 32-bit applications any longer, launching
the 32-bit version of LuaJIT will result in the error message luajit: Bad CPU type in executable
. Use the 64-bit version of LuaJIT on OSX 10.15 onward.
The upkg
executable provides a convenient way of managing ULua:
# On Windows:
cd folder_containing_ulua/ulua/bin
upkg available # List all available packages.
upkg add socket # Download and install the socket package (LuaSocket library).
upkg add pl # Download and install the pl package (PenLight library).
upkg update # Update all packages to the latest version.
# On OSX and Linux:
cd folder_containing_ulua/ulua/bin
./upkg available # List all available packages.
./upkg add socket # Download and install the socket package (LuaSocket library).
./upkg add pl # Download and install the pl package (PenLight library).
./upkg update # Update all packages to the latest version.
ULua features LuaRocks integration: new and updated rocks are automatically tracked, compiled and made available in ULua. More than 300 of such packages are currently available for installation, see LuaRocks Modules.
ULua also features a number of Native packages, i.e. packages that are developed directly for ULua according to its package manager specifications.
It's possible to configure ZeroBrane Studio to use ULua, in which case ULua's installed packages become available inside of ZeroBrane and ZeroBrane itself runs on ULua's binaries.
First of all (this is only needed to support ZeroBrane's Lua debuger feature) make sure that mobdebug
is installed:
# On Windows:
cd folder_containing_ulua/ulua/bin
upkg add mobdebug
# On OSX and Linux:
cd folder_containing_ulua/ulua/bin
./upkg add mobdebug
To configure ZeroBrane to use ULua set the path of ZeroBrane's Lua (5.1) interpreter in the IDE (Edit -> Preferences -> Settings: User -> user.lua:
) to ULua's executable:
--[[--
Use this file to specify **User** preferences.
Check [online documentation](https://studio.zerobrane.com/documentation.html) for details.
--]]--
# On Windows:
path.lua = [[folder_containing_ulua/ulua/lua.cmd]]
# On OSX and Linux:
path.lua = [[folder_containing_ulua/ulua/lua]]