LUA foundation

https://www.runoob.com/lua/lua-functions.html

Comment

Single line–

Multiple lines

–[[

]]

Basic type

nil

This is the simplest, only the value nil belongs to this class, which means an invalid value (equivalent to false in the conditional expression).

boolean

Contains two values: false and true.

number

Represents a double-precision real floating-point number

string

The string is represented by a pair of double quotation marks or single quotation marks

You can also use 2 square brackets “[[]]” to represent “a piece of string”.
Example
html = [[



Novice tutorial


]]
print(html)

Use # To calculate the length of the string, put it in front of the string, as in the following example:

> len = “www.runoob.com”
> print(#len)
14
> print(#”www.runoob.com”)
14
>

function

< p>Functions written in C or Lua

userdata

Any C data structure stored in a variable

thread

Independent line of execution, used to execute cooperative programs

table

The table in Lua is actually an “associative array” (associative arrays), and the index of the array can be a number , String or table type. In Lua, the creation of a table is done through a “construction expression”. The simplest construction expression is {}, which is used to create an empty table.

print(type(“Hello world”)) –> string
print(type(10.4*3)) –> number
print(type(print)) –> function
print(type(type)) –> function
print(type(true)) –> boolean
print(type(nil)) print(type() nil
print(type( type(X))) –> string

nil Double quotes should be added when comparing “:> type(X)nil> type(X)==nilfalse> type(X)==” nil”true>type(X)==nil is false because type(type(X))==string.

> len = “www.runoob.com”
> print(#len)
14
> print(#”www.runoob.com”)
14
>

> len = “www.runoob.com”
> print(#len)
14
> print(#”www.runoob.com”)
14
>

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3228 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.