The luarocks
package can be installed on a Windows Linux Subsystem.
Once installed, to use it, use luarocks
inside a WSL shell or wsl luarocks
within a Windows shell.
wsl # Enter WSL shell (if installed and enabled)
sudo apt-get update # Update package lists (otherwise luarocks may not be found)
sudo apt-get install luarocks # Install luarocks
Installed "rocks" will only be available within WSL, not Windows.
Due to this WSL may have issues with Windows paths. The command wsl wslpath <path>
may help in select cases where a path conversion is needed.
Scoop
You can use scoop to install lua-for-windows
which includes luarocks
.
# Install Scoop (run in PowerShell)
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
# Windows Shell
scoop install lua-for-windows
Some rocks can be used within on the command line (like ldoc
), they will not be within your %PATH%
.
You can create a .cmd
file in %USERPROFILE%\scoop\shims
to work around this.
e.g.
:: Contents for "%USERPROFILE%\scoop\shims\ldoc.cmd"
@echo off
set LDOCPATH=%USERPROFILE%\scoop\apps\lua-for-windows\current\rocks\ldoc\1.4.6-2\bin\ldoc.lua
@lua "%LDOCPATH%" %*
Refer to the offical instructions for more details.
Ah yes I should've mentioned an
sudo apt-get update
may be needed. Added this to instructions