Measures Concepts
GitHub icon

Lua

Lua - Programming language

< >

Lua is an open source programming language created in 1993 by Roberto Ierusalimschy.

#34on PLDB 31Years Old 244kRepos

Try now: Riju · TIO · Replit

Lua ( LOO-ə, from Portuguese: lua [ˈlu.(w)ɐ] meaning moon) is a lightweight, multi-paradigm programming language designed primarily for embedded systems and clients. Lua is cross-platform, since the interpreter is written in ANSI C, and has a relatively simple C API. Lua was originally designed in 1993 as a language for extending software applications to meet the increasing demand for customization at the time. Read more on Wikipedia...


Example from Riju:
print("Hello, world!")
Example from hello-world:
print("Hello World")
# Hello World in Lua print "Hello world"
Example from Linguist:
-- A simple counting object that increments an internal counter whenever it receives a bang at its first inlet, or changes to whatever number it receives at its second inlet. local HelloCounter = pd.Class:new():register("h-counter") function HelloCounter:initialize(sel, atoms) self.inlets = 2 self.outlets = 1 self.num = 0 return true end function HelloCounter:in_1_bang() self:outlet(1, "float", {self.num}) self.num = self.num + 1 end function HelloCounter:in_2_float(f) self.num = f end
Example from Wikipedia:
$ cc -o example example.c -llua $ ./example Result: 8
and break do else elseif end false for function if in local nil not or repeat return then true until while

Language features

Feature Supported Token Example
Scientific Notation
Conditionals
Functions
While Loops
Booleans true false
Strings "
Print() Debugging print
Maps
https://www.lua.org/pil/2.5.html
Line Comments --
-- A comment
Operator Overloading
Assignment
MultiLine Comments --[[ --]]
--[[
A comment.
--]]
Comments
Case Insensitive Identifiers X
Semantic Indentation X

View source

- Build the next great programming language · Search · Add Language · Features · Creators · Resources · About · Blog · Acknowledgements · Queries · Stats · Sponsor · Day 605 · feedback@pldb.io · Logout