lua programming language

Views:
 
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Lua Presentation:

Lua Presentation

Slide 2:

Lua from Portuguese meaning " moon ") is a lightweight multi-paradigm programming language designed as a scripting language with extensible semantics as a primary goal. Lua has a relatively simple C API compared to other scripting languages.

Slide 3:

Lua is designed, implemented, and maintained by a team at PUC-Rio, the Pontifical Catholic University of Rio de Janeiro in Brazil. Lua was born and raised in Tecgraf, the Computer Graphics Technology Group of PUC-Rio, and is now housed at Lablua. Both Tecgraf and Lablua are laboratories of the Department of Computer Science of PUC-Rio. History of Lua

Slide 4:

Lua was created in 1993 by Roberto Ierusalimschy, Luiz Henrique de Figueiredo , and Waldemar Celes, members of the Computer Graphics Technology Group (Tecgraf) at the Pontifical Catholic University of Rio de Janeiro, in Brazil. History of Lua

Slide 5:

Lua is a powerful, fast, lightweight, embeddable scripting language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode for a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.

Slide 6:

Lua's historical 'father and mother' were data-description/configuration languages SOL (Simple Object Language) and DEL (data-entry language). They had been independently developed at Tecgraf in 1992-1993 to add some flexibility into two different projects (both were interactive graphical programs for engineering applications at Petrobras company). Predecessors:

Slide 7:

Versions: Lua 1.0 was never released publicly, but it was up and running on 28 Jul 1993 , and most probably a couple of months before that. Lua 1.1 was released on 08 Jul 1994 . This was the first public release of Lua and is described in a conference paper. Lua 1.1 already featured powerful data description constructs, simple syntax, and a bytecode virtual machine. Lua 1.1 was freely available for academic purposes; commercial uses had to be negotiated, but none ever were.

Slide 8:

Lua 2.1 was released on 07 Feb 1995 . The main new features of Lua 2.1 are extensible semantics via fallbacks and support for object-oriented programming. This version was described in a journal paper . Starting with Lua 2.1, Lua became freely available for all purposes, including commercial uses. Lua 2.2 was released on 28 Nov 1995 . The main new features of Lua 2.2 are long strings, the debug interface, better stack tracebacks, extended syntax for function definition, garbage collection of functions, and support for pipes.

Slide 9:

Lua 2.3 was never released publicly; it only existed as a beta version. Lua 2.4 was released on 14 May 1996. The main new features of Lua 2.4 are the external compiler luac , an extended debug interface with hooks, and the "getglobal" fallback. Lua 2.5 was released on 19 Nov 1996 . The main new features of Lua 2.5 are pattern matching and vararg functions.

Slide 10:

Lua 3.0 was released on 01 Jul 1997 . The main new feature of Lua 3.0 are tag methods as a powerful replacement for fallbacks. Lua 3.0 also introduced auxlib, a library for helping writing Lua libraries, and support for conditional compilation (dropped in Lua 4.0). Lua 3.1 was released on 11 Jul 1998 . The main new features in Lua 3.1 are anonymous functions and function closures via "upvalues" (Lua 5.0 brought full lexical scoping and dropped upvalues.) This brings a flavor of functional programming to Lua. There is also support for multiple global contexts, but the API is not fully reentrant (this had to wait until Lua 4.0).

Slide 11:

Lua 3.2 was released on 08 Jul 1999 . The main new features in Lua 3.2 are a debug library and new table functions. The last release was Lua 3.2.2 , released on 22 Feb 2000 . Lua 4.0 was released on 06 Nov 2000 . The main new features in Lua 4.0 are multiples states, a new API, "for" statements, and full speed execution with full debug information. Also, Lua 4.0 no longer has built-in functions: all functions in the standard library are written using the official API. The last release was Lua 4.0.1 , released on 04 Jul 2002 .

Slide 12:

Lua 5.0 was released on 11 Apr 2003. The main new features in Lua 5.0 are collaborative multithreading via Lua coroutines, full lexical scoping instead of upvalues, and metatables instead of tags and tag methods. Lua 5.0 also introduces booleans, proper tail calls, and weak tables. Other features are better support for packages, new API for loading Lua chunks, new error handling protocol, better error messages, and much more. Lua 5.0 is the first version to be released under the new license. The last release was Lua 5.0.3 , released on 26 Jun 2006 .

Slide 13:

Lua 5.2 was released on 23 Nov 2010 and is available for testing. The main features in Lua 5.2 are yieldable pcall and metamethods, nelexical scheme for globals, ephemeron tables, new library for bitwise operations, light C functions, emergency garbage collector.

Slide 14:

Features/ Characteristics multi-paradigm language does not contain explicit support for inheritance easily with metatables implement namespaces and classes first-class functions functional programming

Slide 15:

Advantages of Lua Lua is fastest language Lua is portable Lua is embeddable Lua is powerful (but simple) Lua is free open-source software

Slide 16:

Disadvantages of Lua An inherent is that it’s a fairly rarely-used language. An implementation is that it currently dependent on an external Lua binary installation.

Slide 17:

Boolean values numbers (double-precision floating point by default) strings. Typical data: arrays, sets, lists, and records can be represented using Lua’s single native data structure, the table, which is essentially a heterogeneous associative array Data Type

Slide 18:

print ('1: Hello World')print ("2: Hello World") The Result: 1: Hello World2: Hello World Literals and output in Lua Example

Slide 19:

A simple array of strings: array = { "a", "b", "c", "d" } print(array[2]) print(#array) array[0] = "z" print(#array) An array of objects: function Point(x, y) return { x = x, y = y } end array = { Point(10, 20), Point(30, 40), Point(50, 60) } print(array[2].y)

Slide 20:

Creating a basic vector object: Vector = {} the class methods function Vector:new(x, y, z local object = { x = x, y = y, z = z } setmetatable(object, { __index = Vector }) return object end function Vector:magnitude() return math.sqrt(self.x^2 + self.y^2 + self.z^2) end vec = Vector:new(0, 1, 0) print(vec:magnitude()) print(vec.x)

Slide 21:

For-loop: for variable = 0, 10, 2 do print ( variable ) end Loops: While-loop: i = 1while i <= 5 do print (i) i = i + 1 end

authorStream Live Help