Download presentation
Presentation is loading. Please wait.
Published byAlexandra Anderson Modified over 9 years ago
1
Lua Matthew Spain | Kerry Zhao
2
Agenda Overview of Lua Language Details Application Areas Demo Conclusion
3
Overview
4
History Made by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes in 1993 Members of Tecgraf, PUC-Rio in Brazil Brazil had trade barriers making it hard to buy software from abroad
5
Release Timeline Jul 1993 - Lua 1.0 Jul 1994 - Lua 1.1 (first public release), paper Feb 1995 - Lua 2.1 (first free commercial release) Nov 2000 - Lua 4.0, no built-in functions Apr 2003 - Lua 5.0, multithreading, full lexical scoping Dec 2011 - Lua 5.2, current version
6
Language Influences Replaces o DEL (data-entry language) o SOL (simple object language) Scheme Modula
7
Resources www.lua.org www.lua-users.org code.google.com/p/luaforwindows luadist.org Plugins for most popular IDEs
8
Language Details
9
Function High-level scripting language Lightweight - interpreter about 180k Embedded language - C API
10
Execution Interpreter compiles to bytecode for Lua VM Very fast, usually compiled at run-time Programs can be compiled in advance to skip overhead Portable, builds on anything with a C compiler
11
Paradigms Multi-paradigm Imperative Functional Not object-oriented, but object-like constructs can be made using tables and metatables
12
Lexical/Syntactical Fun
13
Reserved Keywords and break do else elseif end false for function goto if in local nil not or repeat return then true until while
14
Types nil boolean numbers strings tables functions userdata threads
15
Control Flow if...then…else…elseif…end for...do...end while…do...end repeat...until
16
Assignment “multiple” assignment o a, b, c = “this is multiple assignment”, “yep” i.e. a = “this is multiple assignment”, b = “yep”, c = nil o a, b = b, a a and b have swapped values o a = a or b if not a, a = b
17
Tables EVERYTHING IS A TABLE
18
Typing and scope Strongly typed Dynamic typing local keyword specifies non-globals Symbol table easily accessible
19
Special features Metatables Closures Special allowance for object oriented programmers
20
Metatables None by default, added with setmetatable Metamethods include: o add o sub o mul o div o mod o pow o unm o concat o len o eq o lt o le o index o newindex o call
21
Closures a function inside of a function inner function has access to local variables of the outside function
22
Object-oriented Features No classes, only prototypes Syntactic sugar for methods: function table.func(self, args) can be written as table:func(args)
23
Application Areas
24
GAMING Notables include World of Warcraft, FarCry, the CryENGINE2, Garry’s Mod, Angry Birds
25
Application Areas Cont’d IDE’s Operating Systems Plain Text Editors Robotics
26
Demo
27
Conclusion
28
References The Evolution of Lua Programming in Lua, first Edition
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.