Skip to content

Lua

September 29, 2023
March 22, 2016

Lua (programming language) - Wikiwand

The Programming Language Lua
Lua: version history
Lua: demo
Lua: documentation
Lua 5.1 Reference Manual
Lua 5.4 Reference Manual

Lua (programming language) - Wikiwand
lua-users wiki: Home Page
Lua - Wikiversity
Lua Unofficial FAQ (uFAQ)

Lua Short Reference (PDF)

Lua 简明教程 | | 酷 壳 - CoolShell

Metalua

Lua: Good, bad, and ugly parts - ZeroBrane

Tutorials

Fun with Lua
Lua: the world's most infuriating language
Learn Lua in 15 Minutes
Learn Lua in 15 minutes | Corona Labs
Programming in Lua (1st Edition) for Lua 5.0; 2nd Edition for 5.1; 3rd Edition for 5.2ï¼›4th Edition for 5.3

LewisJEllis/awesome-lua: A curated list of quality Lua packages and resources.
mysandbox/lua at master · arch-jslin/mysandbox
pkulchenko/ZeroBraneEduPack: A collection of simple lessons, scripts, and demos in Lua, suitable for learning programming concepts.

Intro to Programming in Lua - YouTube
Learning Lua - YouTube

Leafo

He's the one behind LuaRocks, MoonScript, Lapis.

leafo's Guides
Using PostgreSQL with OpenResty leafo/pgmoon: A pure Lua Postgres driver for use in OpenResty & more
An introduction to Parsing Expression Grammars with LPeg lpeg

LuaJIT

LuaJIT is faster then v8. However it conforms only to Lua 5.1 spec (not the latest) and its standard library, supports some Lua 5.2 features as extensions. Support for Lua 5.2 and 5.3 is a huge task.

For those that think that LuaJIT's 5.1 compatibility isn't too far behind 5.3, be aware that Lua changes a lot in its minor versions.
To give you an idea, 5.2 introduced changed how scope works (both some stuff with lexical/global scope, and by redoing environments), introduced the goto statement, finalisers, and changed how break works.
5.3 introduced integers (Lua was previously like Javascript with only one Number type which was backed by a double), and utf8 support.
This means that upgrading a Lua version can be a big deal and break all of the programs written in it. For instance, redis and WoW both still embed 5.1.

The LuaJIT Project
mkottman/AndroLua
luapower - The LuaJIT distribution for Windows, Linux and OS X

bobsayshilol/luajit-decomp: LuaJIT decompiler

Embedding LuaJIT in 30 minutes (or so) | The CZ.NIC Staff Blog

Clue

ClueLang/Clue: C/Rust like programming language that compiles into Lua code
Home · ClueLang/Clue Wiki
Clue Online stub

MoonScript

MoonScript, a language that compiles to Lua
MoonScript Online Compiler
Language Guide - MoonScript 0.4.0

Overview of Differences & Highlights

An in-depth look into the MoonScript class implementation

eLua

eLua - eluaproject for micro-controllers
eLua Project on GitHub

Tools

how to create executables (without lua dependency)?
Luarock's build system (rockspec)?

amalg.lua dependency bundler
Squish [Matthew Wild] dependency bundler, minifier and compiler
lua-users wiki: Bin To Cee
L-Bia Home but it says it doesn't do that
stevedonovan/luabuild: A highly customizable Lua 5.2 build system, allowing for common external modules to be linked in statically, and built-in modules to be excluded http://lua-users.org/lists/lua-l/2012-04/msg00639.html

Luiz Henrique de Figueiredo: Libraries and tools for Lua !important
example of distributed Lua tools, srlua
Lua Toolbox
leafo/moonscrape: web scraper

Embedding Lua

Lua itself is designed to be an "embedded language". Embedding the Lua Runtime to a C program is one of it's use case.

It is used in VLC, Adode Photoshop, Adode Lightroom, World of Warcraft, AwesomeWM
A stripped console-only Lua CLI for use with shell scripts - The VideoLAN Forums

Nginx

nginx.md#openresty

Lua + Nginx = magic

Bindings

LuaJIT provides an easy(-er) to use Foreign Function Interface.
FFI Library
Introduction to LuaJIT & How to bind CPP code base using LuaJIT FFI // Speaker Deck

FFI is also backported to Lua.
jmckaskill/luaffi: Standalone FFI library for calling C functions from lua. Compatible with the luajit FFI interface.

kyren/rlua: High level Lua bindings to Rust

IDE

ZeroBrane Studio - Lua IDE/editor/debugger for Windows, Mac OSX, and Linux

LuaRocks

LuaRocks - The Lua package manager
luarocks documentation (API)
Documentation · keplerproject/luarocks Wiki
Using LuaRocks · keplerproject/luarocks Wiki
~/.luarocks/config.<version>

LuaRocks is implemented upon Lua's package and require mechanism.

paths

Using LuaRocks to install packages in the current directory
Rocks are installed to:

eval $(luarocks path --bin)
lua -e 'print(package.path)'
lua -e 'print(package.cpath)'

Add this to ~/.luarocks/config.lua to make this the default:
local_by_default=true

-- modules_path.lua
local version = _VERSION:match("%d+%.%d+")
package.path = 'lua_modules/share/lua/' .. version .. '/?.lua;lua_modules/share/lua/' .. version .. '/?/init.lua' .. package.path
package.cpath = 'lua_modules/lib/lua/' .. version .. '/?.so' .. package.path

the question mark is used to interpolate the package name
mimic $(luarocks path)

Rocks

A rock is a zip file containing the rockspec and all files needed to install the module.
Each version of a rock get its own .rockspec.
A .rockspec may build multiple rocks.

About - LuaRocks

Packages

Penlight Lua's battery
torch/paths
leafo/etlua: Embedded Lua templates
leafo/loadkit: Loadkit allows you to load arbitrary files within the Lua package path
hishamhm/f-strings: String interpolation for Lua
dkjson - dkjson
pkulchenko/serpent: Lua serializer and pretty printer
LDoc documentation

mpeterv/luacheck: A tool for linting and static analysis of Lua code.

Concurrency

Re: Question about multi-threading in Lua
What multithreading package for Lua "just works" as shipped? - Stack Overflow
Lua Coroutine Roundup | William A Adams

CLI

Argparse: Feature-rich command line parser for Lua source
luaposix/luaposix: Lua bindings for POSIX APIs

Testing

busted : Elegant Lua unit testing, by Olivine-Labs source
LuaCov - Coverage analysis for Lua scripts