Lua: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
{|
{|
| valign="top" |
| valign="top" |
<source lang="bash">
<syntaxhighlight lang="bash">
sudo apt install lua5.4 liblua5.4-dev
sudo apt install lua5.4 liblua5.4-dev
sudo apt install luarocks
sudo apt install luarocks
</source>
</syntaxhighlight>


| valign="top" |
| valign="top" |
Line 35: Line 35:
|-
|-
| valign="top" |
| valign="top" |
<source lang="bash">
<syntaxhighlight lang="bash">
export LUA_PATH=/usr/bin/lua5.4
export LUA_PATH=/usr/bin/lua5.4
export LUA_INTERPRETER=/usr/bin/lua5.4
export LUA_INTERPRETER=/usr/bin/lua5.4
</source>
</syntaxhighlight>


| valign="top" |
| valign="top" |
Line 47: Line 47:


==LuaRocks==
==LuaRocks==
<source lang="bash">
<syntaxhighlight lang="bash">
wget -cq https://luarocks.org/releases/luarocks-3.9.2.tar.gz -P ${HOME}/Downloads
wget -cq https://luarocks.org/releases/luarocks-3.9.2.tar.gz -P ${HOME}/Downloads
tar -xzf ${HOME}/Downloads/luarocks-3.9.2.tar.gz -C ${HOME}/Downloads
tar -xzf ${HOME}/Downloads/luarocks-3.9.2.tar.gz -C ${HOME}/Downloads
Line 56: Line 56:
./configure && make && sudo make install
./configure && make && sudo make install
sudo luarocks install luasocket
sudo luarocks install luasocket
</source>
</syntaxhighlight>


==LuaSec==
==LuaSec==
<source lang="bash">
<syntaxhighlight lang="bash">
sudo apt update
sudo apt update
cd ~/Documents/lua-playground
cd ~/Documents/lua-playground
Line 68: Line 68:
sed -z "s|/lua/5.1|/lua/5.4|g" -i ./Makefile
sed -z "s|/lua/5.1|/lua/5.4|g" -i ./Makefile
make linux
make linux
</source>
</syntaxhighlight>


==Playground==
==Playground==
Line 93: Line 93:
|-
|-
| valign="top" |
| valign="top" |
<source lang="bash">
<syntaxhighlight lang="bash">
mkdir -p ~/Documents/lua-playground
mkdir -p ~/Documents/lua-playground
cd      ~/Documents/lua-playground
cd      ~/Documents/lua-playground
</source>
</syntaxhighlight>


| valign="top"|
| valign="top"|
<source lang="bash">
<syntaxhighlight lang="bash">
luarocks install moonrocks
luarocks install moonrocks
luarocks install srlua
luarocks install srlua
</source>
</syntaxhighlight>


| valign="top" |
| valign="top" |
<source lang="bash">
<syntaxhighlight lang="bash">
luarocks install lua-json
luarocks install lua-json
luarocks install luaunit
luarocks install luaunit
</source>
</syntaxhighlight>


|-
|-

Latest revision as of 20:52, 31 March 2024

sudo apt install lua5.4 liblua5.4-dev
sudo apt install luarocks
lua --help
luarocks --help
lua -v
luarocks --version

sudo update-alternatives --config lua-interpreter
sudo update-alternatives --config lua-compiler
sudo mkdir -p /usr/local/lib/luarocks/rocks-5.1
ls -lah       /usr/local/lib/luarocks/
ls -lah ~/.luarocks/
luarocks list

export LUA_PATH=/usr/bin/lua5.4
export LUA_INTERPRETER=/usr/bin/lua5.4

LuaRocks

wget -cq https://luarocks.org/releases/luarocks-3.9.2.tar.gz -P ${HOME}/Downloads
tar -xzf ${HOME}/Downloads/luarocks-3.9.2.tar.gz -C ${HOME}/Downloads
rm  -rf  ${HOME}/Downloads/luarocks-3.9.2.tar.gz
cd       ${HOME}/Downloads/luarocks-3.9.2

sudo update-alternatives --config lua-interpreter
./configure && make && sudo make install
sudo luarocks install luasocket

LuaSec

sudo apt update
cd ~/Documents/lua-playground
sudo apt install git gcc libssl-dev

luarocks remove luasec --local
git clone https://github.com/brunoos/luasec.git && cd luasec
sed -z "s|/lua/5.1|/lua/5.4|g" -i ./Makefile
make linux

Playground

runtime only
sudo apt install lua5.4
ls -lah /usr/bin/lua{,c}5.4
runtime + compiler (developer)
sudo apt install lua5.4-dev
ls -lah /usr/include/lua5.4
header to compile (developer)
sudo apt install liblua5.4-dev
ls -lah /usr/include/lua5.4

mkdir -p ~/Documents/lua-playground
cd       ~/Documents/lua-playground
luarocks install moonrocks
luarocks install srlua
luarocks install lua-json
luarocks install luaunit

luarocks install moonrocks --local
luarocks install srlua     --local
luarocks install moonrocks --local --check-lua-versions
luarocks install srlua     --local --check-lua-versions

sudo luarocks install luasocket
luarocks install luasec --local
luarocks --tree=./local install cmark
luarocks list
luarocks search luasec
luarocks show luasec

systemctl list-units --type=service --state=running
systemctl list-units --type=service --state=active
systemctl --type=service --state=running
systemctl --type=service --state=active
sudo luarocks install luafilesystem


References