Examples
Let’s compile LuaRocks!
Clone the source-code:
> git clone --depth 1 https://github.com/luarocks/luarocks > cd luarocks
Compile it into
./luarocks(orluarocks.exeon Windows)# lrc can compile Teal! > lrc src/bin/luarocks -o luarocks.exe -mluarocks.** --xpath teal:src/?? -P "vendor/??;src/??" \ --xpath "teal:types/?.d.tl;src/?.d.tl"
Compile lrc with itself
Clone the source-code:
> git clone https://codeberg.org/lrocket/lrc > cd lrc
Compile!
> lrc cmd/lrc.lua -o lrc.exe
Compile a Website (WebAssembly)
Fetch WebAssembly support:
> luarocks install lrocket-build-wasm
Create a new file called
website.luawith the following contents:-- website.lua document.innerHTML = '<button>Click me!</button>' local button = document.querySelector 'button' button.addEventListener('click', function() alert('Lua function called!') end)
Compile to standalone HTML:
> lrc website.lua --otype wasm-html -o website.html