Presentation is loading. Please wait.

Presentation is loading. Please wait.

What is Lua? Brandon Burgess Csc 415.

Similar presentations


Presentation on theme: "What is Lua? Brandon Burgess Csc 415."— Presentation transcript:

1 What is Lua? Brandon Burgess Csc 415

2 Conception Lua was created and is maintained in Brazil
Created by a small committee at PUC-Rio’s TecGraf The brainchild of three men’s experience with creating languages In 1993 DEL and Sol were combined to create Lua

3 Early Years Version 1 - Graphic Metafiles, just-in-time compiler, compiler speed (1994) Version 2 - Extensible extensive language(fall backs) (1995) International Exposure and V3 – Games and Tags ( ) Version 4 – API change (state issues) and For Loops (2000)

4 Names, Bindings, and Scopes
Keywords (false, nil, return) Lua C API, Basic Lua Api (Lua.h), Auxilary library (lauxlib.h) Global or Local local x = 5 local function f() print (x) end f() Prints 5 x = 6 f() Prints 6

5 Data Types Dynamically Typed
Boolean, Number, String, Nil, Function, Userdata, Thread, and Table. Can call functions based in C Objects (table, function, thread, and userdata)

6 Assignments Blocks and Chunks
Comma Separated Assignments( a, b = 10, 2*x) Discarding Excess, Filling with Nil. A=6 A, B = A+2, A  B still equals 6 before A changes to 8

7 Control Structures While  while exp do block end
Repeat  repeat block until exp If  if exp then block {else if} [else] end Numeric For  for name = exp , exp [, exp] do block end Generic For  for namelist in explist do block end

8 Expressions Supported Operators And and OR ( 10 or 20) vs (10 and 20)
Table Constructors a = { [f(1)] = g, “x”, “y”, [20] = 5 }

9 Object Oriented Tables are All Unique Inheritance (_index)
Tablesception Function Table:new (o) O = O or { } setmetatable(o, self) Self._index = self Return O End A = Table:new

10 Concurrency Coroutines Create Execute Yield Resume

11 Garbage Collection Mark and Sweep


Download ppt "What is Lua? Brandon Burgess Csc 415."

Similar presentations


Ads by Google