Although Lua is called an interpreted language, LUA does allow the source code to be precompiled into an intermediate form (analogy to Python's. PYc) before running the source code. The main feature of the differential interpretation language is
The metatable in Lua is a common table, but it has the following features:
1. Define the behavior of arithmetic operators and relational operators2. Providing support for the LUA function library3. Control access to table
Metatables defines
Recently, we've been using Cocos2d-x + LUA to develop the game. The main logic of the game will be written in Lua, with no prior contact with Lua, and here are the introductory notes I've summarized.
Operator
logical operators
With: andOr: ORNon:
1. Digital operation
Support +,-, *,/,^. The operands of these operators are all real numbers.
2. Connection operation
Connect two strings, using the "..." Operator.If the operand is a number, LUA converts the number to a string.
3. Assignment
The Border property (border) is used to set the edge of an element.Margin attributes (margin) are used to set the distance between the edges of an element's space and the adjacent elements.The gap attribute (padding) is the distance used to set the
Setmetatable (table, metatable)
Each value in Lua can be used with a metatable. This metatable is an original Lua table that defines the behavior of the original values under specific actions. You can change the behavior of the specified operation
--table feature-
-use table to generate positive and descending lists-
-use table to generate list
= Nil local
file = Io.open ("Table.lua", "R")--> Open
The pre = nil
--read this file in the list in row order in
File:lines () does current
=
In Lua, a function is a "first class value" that has a specific lexical domain.
First Class value: Representation in Lua, functions have the same rights as other traditional types of values (numbers and strings), functions can be stored in a
Lua's own time functions can only be accurate to seconds.
In order to count the time of millisecond precision, you can use Luasocket. Download Address Http://files.luaforge.net/releases/luasocket/luasocket
When compiling the installation, you may
Assignment statement
Note, the single line is represented by (-), Multiline (--[[...]) To mark;Definition, which is not defined in LUA (declaring the data type), it is assigned a value to determine its data type.Assignment is the most basic way to
Copy Code code as follows:
function foo ()
Print (g or "No g defined!")
End
Foo ()
Setfenv (foo, {g = m, print = print})--set Foo's environment as table {g=100, ...}
Foo ()
Print (g or "No g defined!")
--no g defined!
--100
The table library is composed of auxiliary functions that manipulate the table as an array. There are functions that insert and delete elements in the list, functions that have array elements sorted, and functions that link all the strings in an
Author: Legend
Source: http://www.ugia.cn/?p=85
In AJAX applications, usually a page to send multiple requests at the same time, if there is only one XMLHttpRequest object, the previous request has not been completed, the following will be the front
The following code results are: false,true,true
May I ask why the first one in the result is false?
String:
Mode://
the first one should beRe=new RegExp ("^\\d*$");
\ need to escape in quotation marks
The first pair has double quotes, double
In the last section of this chapter, Zeev discusses the object model brought by the Zend engine, specifically how it differs from the models in the previous versions of PHP.
When we developed the PHP3 in the summer of 1997, we had no plans to make
A property of an object instance is a variable, just like any other variable in PHP. But you have to use the-> operator to refer to them. You do not need to use dollar $ $ before attributes. For example, 6.1 prints the line of the user object's Name
--------------
Understand what you want to ask.
--------------
Rambling questions almost endless time black holes. The one who can give you the most useful answers is the busiest.
People (they are busy because they have to do most of the
First, as we mentioned earlier, if the second parameter in the Replace () method is a callback function, then the parameter in the callback function is the result of the match success .... , do you think there are multiple parameters in the callback
In the registration system development, the need to detect the user input email address is legitimate, can be detected in JS or PHP, but the difference is not small, can use regular expression to detect.
Here is an example of JS:
Copy Code
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service