Lua: Difference between revisions
Jump to navigation
Jump to search
| (22 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{| | {|class='wikitable' | ||
| valign= | |- | ||
< | |valign='top' style='width:50%'| | ||
sudo apt install lua5.4 | <syntaxhighlight lang='bash'> | ||
sudo apt install lua5.4 liblua5.4-dev | |||
sudo apt install luarocks | sudo apt install luarocks | ||
</ | </syntaxhighlight> | ||
|valign='top' style='width:50%'| | |||
| valign= | |||
lua --help | lua --help | ||
luarocks --help | luarocks --help | ||
|- | |||
| valign= | |valign='top'| | ||
lua -v | lua -v | ||
luarocks --version | luarocks --version | ||
|valign='top'| | |||
ls -lah ~/.luarocks/ | |||
luarocks list | |||
|- | |- | ||
|valign='top'| | |||
| valign= | |||
sudo update-alternatives --config lua-interpreter | sudo update-alternatives --config lua-interpreter | ||
sudo update-alternatives --config lua-compiler | sudo update-alternatives --config lua-compiler | ||
| valign= | |valign='top'| | ||
sudo mkdir -p /usr/local/lib/luarocks/rocks-5.1 | sudo mkdir -p /usr/local/lib/luarocks/rocks-5.1 | ||
ls -lah /usr/local/lib/luarocks/ | ls -lah /usr/local/lib/luarocks/ | ||
|- | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
export LUA_PATH=/usr/bin/lua5.4 | |||
export LUA_INTERPRETER=/usr/bin/lua5.4 | |||
</syntaxhighlight> | |||
| valign= | |valign='top'| | ||
|} | |||
==LuaRocks== | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
LuaRocks | |||
|- | |- | ||
| | |valign='top' style='width:50%'| | ||
---- | <syntaxhighlight lang='bash'> | ||
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 | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
|} | |||
==LuaSec== | |||
{|class='wikitable mw-collapsible' | |||
!scope='col' style='text-align:left' colspan='2'| | |||
LuaSec | |||
|- | |- | ||
| valign= | |valign='top' style='width:50%'| | ||
< | <syntaxhighlight lang='bash'> | ||
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 | |||
</syntaxhighlight> | |||
|valign='top' style='width:50%'| | |||
|} | |} | ||
==Playground== | ==Playground== | ||
{| | {|class='wikitable mw-collapsible' | ||
| valign= | !scope='col' style='text-align:left' colspan='2'| | ||
< | Playground | ||
|- | |||
|valign='top' style='width:50%'| | |||
'''runtime only''' | |||
sudo apt install lua5.4 | |||
ls -lah /usr/bin/lua{,c}5.4 | |||
|valign='top' style='width:50%'| | |||
'''runtime + compiler (developer)''' | |||
sudo apt install lua5.4-dev | |||
ls -lah /usr/include/lua5.4 | |||
|- | |||
|valign='top'| | |||
'''header to compile (developer)''' | |||
sudo apt install liblua5.4-dev | |||
ls -lah /usr/include/lua5.4 | |||
|valign='top'| | |||
<syntaxhighlight lang='bash'> | |||
mkdir -p ~/Documents/lua-playground | mkdir -p ~/Documents/lua-playground | ||
cd ~/Documents/lua-playground | cd ~/Documents/lua-playground | ||
</ | </syntaxhighlight> | ||
|- | |||
| valign= | |valign='top'| | ||
< | <syntaxhighlight lang='bash'> | ||
luarocks install moonrocks | luarocks install moonrocks | ||
luarocks install srlua | luarocks install srlua | ||
</ | </syntaxhighlight> | ||
| valign= | |valign='top'| | ||
< | <syntaxhighlight lang='bash'> | ||
luarocks install lua-json | luarocks install lua-json | ||
luarocks install luaunit | luarocks install luaunit | ||
</ | </syntaxhighlight> | ||
|- | |- | ||
| valign= | |valign='top'| | ||
luarocks install moonrocks --local | luarocks install moonrocks --local | ||
luarocks install srlua --local | luarocks install srlua --local | ||
| valign= | |valign='top'colspan="2" | | ||
luarocks install moonrocks --local --check-lua-versions | luarocks install moonrocks --local --check-lua-versions | ||
luarocks install srlua --local --check-lua-versions | luarocks install srlua --local --check-lua-versions | ||
|- | |||
|valign='top'| | |||
sudo luarocks install luasocket | |||
luarocks install luasec --local | |||
|valign='top'| | |||
luarocks --tree=./local install cmark | |||
luarocks list | |||
|- | |||
|valign='top'| | |||
luarocks search luasec | |||
luarocks show luasec | |||
|valign='top'| | |||
systemctl list-units --type=service --state=running | |||
systemctl list-units --type=service --state=active | |||
|- | |||
|valign='top'| | |||
systemctl --type=service --state=running | |||
systemctl --type=service --state=active | |||
|valign='top'| | |||
sudo luarocks install luafilesystem | |||
# | |||
|} | |} | ||
==References== | ==References== | ||
{| | {|class='wikitable mw-collapsible' | ||
| valign= | !scope='col' style='text-align:left' colspan='3'| | ||
References | |||
|- | |||
|valign='top' style='width:33%'| | |||
* [https://www.lua.org/manual/5.4/ Lua » Reference Manual] | * [https://www.lua.org/manual/5.4/ Lua » Reference Manual] | ||
* [https://www.lua.org/docs.html Lua » Documentation] | * [https://www.lua.org/docs.html Lua » Documentation] | ||
| Line 94: | Line 162: | ||
* [https://replit.com/ Lua » IDE » Replit] | * [https://replit.com/ Lua » IDE » Replit] | ||
| valign= | |valign='top' style='width:34%'| | ||
* [https://opensource.com/article/19/11/getting-started-luarocks Lua » Make development easy with Luarocks] | |||
* [https://medium.com/@Games24x7Tech/running-atomicity-consistency-use-case-at-scale-using-lua-scripts-in-redis-372ebc23b58e Lua » Running Atomicity Consistency] | * [https://medium.com/@Games24x7Tech/running-atomicity-consistency-use-case-at-scale-using-lua-scripts-in-redis-372ebc23b58e Lua » Running Atomicity Consistency] | ||
* [https://www.linkedin.com/advice/1/what-pros-cons-using-c-vs-lua-game-scripting-skills-game-design Lua » Pros and Cons » C# vs. Lua] | * [https://www.linkedin.com/advice/1/what-pros-cons-using-c-vs-lua-game-scripting-skills-game-design Lua » Pros and Cons » C# vs. Lua] | ||
* [https://www.lua.org/pil/contents.html Lua » Programming » 1st Edition] | * [https://www.lua.org/pil/contents.html Lua » Programming » 1st Edition] | ||
* [https://github.com/leafo/moonrocks Lua » LuaRocks » MonoRocks] | * [https://github.com/leafo/moonrocks Lua » LuaRocks » MonoRocks] | ||
* [https://luarocks.org/modules/brunoos/luasec Lua » LuaRocks » LuaSec] | |||
* [https://github.com/luarocks/luarocks/wiki/Download#installing Lua » LuaRocks » Install] | * [https://github.com/luarocks/luarocks/wiki/Download#installing Lua » LuaRocks » Install] | ||
* [https://redis.io/docs/interact/programmability/eval-intro/ Lua » Redis Scripting] | * [https://redis.io/docs/interact/programmability/eval-intro/ Lua » Redis Scripting] | ||
| Line 104: | Line 174: | ||
* [https://github.com/LuaDist/srlua Lua » srlua] | * [https://github.com/LuaDist/srlua Lua » srlua] | ||
| valign= | |valign='top' style='width:33%'| | ||
|- | |- | ||
| valign= | |valign='top'| | ||
* [https://innovativeinnovation.github.io/ubuntu-setup/ Ubuntu setup] | |||
* [https://pkg.go.dev/github.com/toophy/gopher-lua GopherLua] | * [https://pkg.go.dev/github.com/toophy/gopher-lua GopherLua] | ||
* [[Homebrew]] | * [[Homebrew]] | ||
| Line 117: | Line 184: | ||
* [[Locust]] | * [[Locust]] | ||
* [[LuaJIT]] | * [[LuaJIT]] | ||
* [[Rust]] | |||
* [https://en.wikipedia.org/wiki/Luit Luit] | * [https://en.wikipedia.org/wiki/Luit Luit] | ||
* [[Wrk]] | * [[Wrk]] | ||
| valign= | |valign='top'| | ||
|valign='top'| | |||
|} | |} | ||
Latest revision as of 06:50, 6 March 2026
sudo apt install lua5.4 liblua5.4-dev
sudo apt install luarocks
|
lua --help luarocks --help |
lua -v luarocks --version |
ls -lah ~/.luarocks/ luarocks list |
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/ |
export LUA_PATH=/usr/bin/lua5.4
export LUA_INTERPRETER=/usr/bin/lua5.4
|
LuaRocks
|
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
|
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
|
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
|
References | ||
|---|---|---|