LUA Vocabulary Conventions

Source: Internet
Author: User
Tags lua uppercase letter

Lua identifiers contain numbers, letters, and underscores, and numbers cannot begin with identifiers.

And break do else ElseIf end
False for function Goto if in
Local nil not OR repeat return
Then true until while

The above can not be used as a keyword, and Java is different goto,local,nil,repeat,until.

Lua is case-sensitive. By convention, the underscore begins with a reserved word, followed by the uppercase letter Lua.

+-*/% ^ # = = ~= <= >= < > = () {} []::; : , . .. ...

A string in Lua can also contain escape sequences, such as \n,\t, if a true escape sequence needs to be represented in a string, followed by an escape sequence after a backslash, such as \\n

The string can also be specified in \xxx and \ddd, and the string in Lua can represent any 8-bit value, and the embedded 0 is specified as '/'.

LUA can build strings with [and = mates, such as A=[[ASDQW]], which is level 0

a=[==[dasd]==] This is level 2, the level is determined by the number of equals sign

For convenience, the newline character is not included in the string, as shown in--a, when the opening brace is immediately followed by a newline character. As an example, in a system that uses ASCII (where ' a ' is encoded as 97, the newline character is encoded as 10, ' 1 ' is encoded as 49), the following five literal strings represent the same string:

A = ' alo \ n123 '
A = "alo \ n123 \" "
A = ' \ 97lo \ 10 \ 04923 "'
A = [[Alo
123 "]
A = [= = [\\--a
Alo
123 "] = =]

Numeric constants can be marked with E or E, and Lua accepts hexadecimal numbers, beginning with 0x or 0X. Hexadecimal constants can also accept decimal and binary indices, marked with ' P ' or ' P '.

3 3.0 3.1416 314.16e-2 0.31416E1
0xFF 0x0.1e 0xa23p-4 0x1.921fb54442d18p+1

Single-line comment with--, multiple lines in--(or-? ) and parentheses.

LUA Vocabulary Conventions

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.