160 likes | 341 Views
Lua. Spencer Pruden Orlando Pile. Background Histroy. 1993 By programmers Roberto Lerusalimschy , Luiz Henrique de Figueiredo , and Waldemar Cales Members of Computer Graphics Technology Group (shortened Tecgraf) at Pontifical Catholic University of Rio de Janeiro. Goals.
E N D
Lua Spencer Pruden Orlando Pile
Background Histroy • 1993 • By programmers Roberto Lerusalimschy, Luiz Henrique de Figueiredo, and WaldemarCales • Members of Computer Graphics Technology Group (shortened Tecgraf) at Pontifical Catholic University of Rio de Janeiro
Goals • offer a new language that featured • Extensibility • Simplicity • Efficiency • Portability
Features • Can Interface with C/C++, other languages, such as FORTRAN, Java, Smalltalk, Ada, and other scripting languages • Simple and small language • one of the fastest languages in the realm of scripting (interpreted) languages • highly portable multi-platform language
Compatible with • Windows • UNIX • Shares same source code with • NextStep, OS/2 • PlayStation II (Sony) • Mac OS-9 and OS X • BeOS, • MS-DOS, • IBM mainframes • EPOC, • PalmOS, • MCF5206eLITE • Evaluation Board, • RISC OS
Data Types • Lua 5.0 • -Threads • -Booleans • earlier versions • Number • String • Table • Function • user data • nil
Similarities with Other Languages • Scheme • semantic structure • first-class functions with lexical scoping • Modula programming language • -use of familiar words • C • -create functions during run-time without compilation and functions also have no declaration
Recursive: function factorial (n) if n == 0 then return 1 else return n*factorial (n-1) end end Iterative: function factorial(n) local a = 1 for i = 1, n do a = a*i end return a end Similarity that the syntax of Lua has with other programming languages demo
Tables • associative arrays which can store arbitrary pairs of values • replace special data structures inside the core with ordinary Lua tables • Lua 4.0 for representing the global environment (which keeps all global variables) • Lua 5.0 for implementing extensible semantics
More on Tables • The tables created can be in the form of lists or arrays which when used with the constructor {}
Strings • Lua 1.1methods for declaring a string • single quotes • double quotes Lua 2.2 ability to use long strings
Control Structures • If begins conditional • while • repeat • for • Terminator = end
Control Structures continued • conditional expression of a control structure can be any value • the values are always true • if they are not already false and “nil”.
Popularity • Where • video game industry • Reasons • small, efficient, and portable • extensive use of scripting languages • the game logic, • trigger events • ability to speed up development time
Conclusion • small package of Lua which allows it to be used for applications in which space constraints are a major factor • the portability of Lua which allows it to be compatible with a large variety of platforms • a highly efficient scripting language which does not consume a large amount of system resources
Sources • Bolton, David, “Lua – a Scripting Language for Games,” About.com, December 23, 2008, accessed April 20, 2012. • http://cplus.about.com/b/2008/12/23/lua-a-scripting-language-for-games.htm • Gao, Lee, “The.Lua.Tutorial, The Crash Course.” • http://luatut.com/crash_course.html, accessed April 29, 2012. • Lerusalimschy, Roberto, Programming in Lua, Lua.org, 2003 • Lerusalimschy, Roberto, Figueiredo, L. H, Celes, W. “The Evolution of Lua”, History of Programming Languages Conferences (HOPL), 2007.