slide1
Download
Skip this Video
Download Presentation
Lua

Loading in 2 Seconds...

play fullscreen
1 / 28

Lua - PowerPoint PPT Presentation


  • 127 Views
  • Uploaded on

Lua. Matthew Spain | Kerry Zhao. Agenda. Overview of Lua Language Details Application Areas Demo Conclusion. Overview. History. Made by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, and Waldemar Celes in 1993 Members of Tecgraf, PUC-Rio in Brazil

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Lua' - sierra


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

Lua

Matthew Spain | Kerry Zhao

agenda
Agenda
  • Overview of Lua
  • Language Details
  • Application Areas
  • Demo
  • Conclusion
history
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
release timeline
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

language influences
Language Influences
  • Replaces
    • DEL (data-entry language)
    • SOL (simple object language)
  • Scheme
  • Modula
resources
Resources

www.lua.org

www.lua-users.orgcode.google.com/p/luaforwindows

luadist.org

Plugins for most popular IDEs

function
Function
  • High-level scripting language
  • Lightweight - interpreter about 180k
  • Embedded language - C API
execution
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
paradigms
Paradigms
  • Multi-paradigm
  • Imperative
  • Functional
  • Not object-oriented, but object-like constructs can be made using tables and metatables
reserved keywords
Reserved Keywords
  • and
  • break
  • do
  • else
  • elseif
  • end
  • false
  • for
  • function
  • goto
  • if
  • in
  • local
  • nil
  • not
  • or
  • repeat
  • return
  • then
  • true
  • until
  • while
types
Types
  • nil
  • boolean
  • numbers
  • strings
  • tables
  • functions
  • userdata
  • threads
control flow
Control Flow
  • if...then…else…elseif…end
  • for...do...end
  • while…do...end
  • repeat...until
assignment
Assignment
  • “multiple” assignment
    • a, b, c = “this is multiple assignment”, “yep”
      • i.e. a = “this is multiple assignment”, b = “yep”, c = nil
    • a, b = b, a
      • a and b have swapped values
    • a = a or b
      • if not a, a = b
tables
Tables
  • EVERYTHING IS A TABLE
typing and scope
Typing and scope
  • Strongly typed
  • Dynamic typing
  • local keyword specifies non-globals
  • Symbol table easily accessible
special features
Special features
  • Metatables
  • Closures
  • Special allowance for object oriented programmers
metatables
Metatables
  • None by default, added with setmetatable
  • Metamethods include:
    • add
    • sub
    • mul
    • div
    • mod
    • pow
    • unm
    • concat
    • len
    • eq
    • lt
    • le
    • index
    • newindex
    • call
closures
Closures
  • a function inside of a function
  • inner function has access to local variables of the outside function
object oriented features
Object-oriented Features
  • No classes, only prototypes
  • Syntactic sugar for methods:

function table.func(self, args)

can be written as

table:func(args)

application areas1
Application Areas
  • GAMING
  • Notables include World of Warcraft, FarCry, the CryENGINE2, Garry’s Mod, Angry Birds
application areas cont d
Application Areas Cont’d
  • IDE’s
  • Operating Systems
  • Plain Text Editors
  • Robotics
references
References
  • The Evolution of Lua
  • Programming in Lua, first Edition
ad