====== Lua Programming Language ====== [[https://www.lua.org/home.html|Lua]] is a scripting language that is commonly embedded within other applications. It is very portable. You can learn to program Lua with the free ebook on the official website, [[https://www.lua.org/pil/contents.html|Programming in Lua, 1st Edition]]. ===== Installing ===== In Debian you can simply use the package manager: sudo apt install lua5.3 Also search for other packages with ''apt-cache search lua'' because there are a lot of libraries available like http, json, filesystem, curl, curses, databases and more. If you want to build from source, it's very easy because it's so portable and written in ANSI C. Simply [[https://www.lua.org/download.html|download]], extract and run ''make''. wget http://www.lua.org/ftp/lua-5.4.3.tar.gz tar zxf lua-5.4.3.tar.gz cd lua-5.4.3 make # sudo apt install build-essential src/lua -v src/luac -v sudo make install # Optional ===== Executing code ===== There are a few ways you could execute a script: * In the interactive REPL: ''lua'' * By invoking the Lua interpreter and passing it a file: ''lua hello.lua'' * By executing a script directly with a shebang (e.g. ''#!/usr/bin/lua'') and run with ''./hello'' * Running a precompiled script. Compile with ''luac hello.lua'' and run with ''lua luac.out'' ===== Hello World ===== print 'hello world'