About Lua
What is Lua-lua is a cross-platform development scripting language.
Lua history
School University of Rio de Janeiro
Country Brazil
Author Roberto ierusalimschy,luiz Henrique Figueiredo Waldemar celes
Group of computer Graphics groups
Company Petrobas
Growth data-entry-language= "sol==" Lua
Lua Time Line
1993-Create
1996-dr. Dobbs's article mentions Lua, which is known by the world
Getting Started with Lua
Basic framework: Platform-OPENGL-Application Layer-framework-LUA code and resources
Set up Lua
Official website: http://www.lua.org
Mac and iOS
Mac comes with
IOS Iluabox,lua Console
LUA features
LUA is implemented as a library of C, and the language itself has no entrance
LUA variables
Alphanumeric underline, the first digit cannot be a number
Key words
And break does else ElseIf end false for function if in local nil not or repeat return to true until while
Hello,lua
MAC Shell Input Lua return
message = "Hello,lua"
Print ("Hello lua")
> Print (1,2,3,4,5, "one")
Output is 1 2 3 4 5 One
String
Escape character \b \ r \ \v \ \ \ \ \ \ \ \ \ \ \ \ \
message = [[My name is John]]
message = ' My name is John ';
message = "My name is John"
Values and Types
define int i; Dim i As Variant;
Type
Nil Null Boolean Boolean value number string string function function UserData c allocated memory block thread thread table
First class functions functions as function arguments
Code blocks and Scopes
Global Local
LUA operators
Arithmetic operator +-*/% (remainder) ^ (exponent)-(negative)
relational operators = = ~= < > <= >=
logical operator and OR not
Connection symbol:
Length Symbol #
Print (# "This is a test");//Draw string length
Pure Lua under MAC (i)