Set up LAMP services (Apache, MySQL, PHP)

2022-12-27  

When there is a language basis, it is very fast to learn a new language grammar.

Note

variable type

operator

Condition branch sentence

cycle sentence

function

Special usage

Objective thinking (not included here), etc.

below the LUA code plus annotation, intuitively explain the above content

-Annotation method 
 -[[[[[[[[[[[[ 
 Multi -row annotation 
 -]] 
 -************************************************************** 
 -LUA all variables do not need to be declared variable types 
 --Lua All variables default to global variables and non-overall Local 
 -LUA does not have various numerical types uniformly. Number type represents the number of floating points and 
 Print ("*************** global local variables **************") 
 LOCAL A = 1 -Located only as much as possible when programming programming 
 Print (a) 
 A1 = 1.5 -overall 
 Print (a1) 
 -LUA is only false and nil in fake 0 and empty string. 
 e = true; 
 Print (e) 
 --Lua String can be included with a single quotation or dual quotation number 
 Print ("*************** strings related ***************") 
 b = 'Single quoted string' 
 Print (b) 
 C = "Double Quota Strings" 
 Print (C) 
 -LUA's string of string is omitted omitted omitted omitted \ n replacement symbols for replacement 
 c = [[I am 
 yours 
 Baby 
 ]] 
 Print (C) 
 -Stian string correlation 
 str = "abcdefg" 
 Print (String.upper (STR))-lowercase a lowercase transgenic uppercase 
 Print (String.lower (STR))-Big-written transgeniccase 
 Print (String.reverse (STR))-flip string 
 Print (string.find (str, "CDE")-string indexing search 
 Print (string.sub (str, 3))-string interception 
 Print (string.rep (str, 3))-string repeat 
 Print (string.gsub (str, "cd", "" ** ")-string modification 
 Print (#Str)-String length 
 a = TRUE 
 Print (tostring (a)); 

 Print (string.format ("I am%s, I am%d this year", "little baby", 2))-string length 
 -LUA When the keyword of the hollow nil is equivalent to NULL in C# 
 Print ("*************** empty reference ***************") 
 d = nil 
 Print (d) 
 Print ("*************** type Get ***************") 
 --Peid stitching symbol .. 
 --Type type judgment 
 Print ("Type judgment" ..type (e)) 

 -****************************************************** 
 Print ("*************** operator *********************** 
 --Lua No self-increase or decrease operator 
 Print ("Add Method" ..1+2) 
 Print ("remaining calculation" ..9%2) 
 Print ("Unsus operation" ..9-2) 
 Print ("multiplication operation" ..9*2) 
 Print ("Exploresting Fa Complex" ..9/2) 
 Print ("Power Computing" ..9^2) 
 -***************************************************************** 
 Print ("**************** conditional phrases ***************") 
 a = 9 
 if a> 9 then 
 Print ("greater than 9") 
 elseif a> = 5 the 
 Print ("greater than 5") 
 elseif a == 3 then 
 Print ("Value is 3") 
 elseif a ~ = 2 then -not equal to 
 Print ("Value is 3") 
 end 
 --********************Logical Operators******************** 
 Print ("*************** logic operator *****************") 
 a = TRUE 
 B = FALSE 
 if a and b the -logic and and 
 Print ("greater than 9") 
 elseif a or b5 then -logic or 
 Print ("greater than 5") 
 Elseif Not a THEN - logic 
 Print ("Other numbers") 
 end 
 --********************loop statement******************** 
 Print ("*************** cycle sentence **************") 
 --While loop 
 
 num = 0 
 While num <5 Do 
 Print (num); 
 num = num + 1 
 end 
 --Do While loop 
 
 a = 1; 
 Repeat 
 Print (a); 
 a = a + 1 
 Unil a> 5 
 --For loop 
 Print ("************** to cycle ***************"); 
 for i = 1,5 do -default increase +1 
 Print (i) 
 end 

 for i = 5,1, -1 DO-decrease 1 
 Print (i) 
 end 
 --********************function******************** 
 Print ("************** function *********************** 
 Function f (x) 
 Return x^2 
 end 
 Print (f (2)) 

 Function F2 (X2) 
 if X2 <10 THEN 
 Print ("White roll") 
 elseif x2 <60 then 
 Print ("too low") 
 elseif x2 <70 then 
 Print ("and grid") 
 end 
 end 
 F2 (2) 
 Print ("***************, changing parameter function ******************* 
 function ff (...) 
 local arg = {...} 
 LOCAL TOTAL = 0 
 for i = 1,#ARG Do 
 Total = Total + ARG [i] 
 end 
 Print (Total) 
 end 
 FF (1,2,3,4,5,6) 

 Print ("************** Functional norm ***************") 
 Function F3 (x) 
 Return function (y) Return x + y end 
 end 
 a = f3 (1) 
 Print (a (2)) 

 -***************************** ********************** 
 Print ("************** complex data type ***************") 
 -All complex types are table (Table) 
 --Adder 
 Print ("***************, list ****************") 
 -The storage type of array can be mixed, and the default index starts from 1 
 a = {1,2,3, "12312", 123123} 
 Print (a [1]) 
 Print (a [4]) 
 Print (#A) -top length from 1 
 Print ("*************** array traversing ***************") 
 for i = 1,#A do 
 Print (a [i]) 
 end 
 -The can customize indexes or even negative indexes 
 Print ("************** custom index ***************") 
 a = {[0] = 1,2,3, [-1] = 4,5} 
 Print (a [0]) 
 Print (a [1]) 
 Print (a [-1]) 
 Print (a [2]) 
 Print (a [3]) 
 Print (#A) -The printing length in the middle of the section is broken and the count will be stopped 
 Print ("*************** two -dimensional array ***************") 
 a = {{1,2,3}, {4,5,6}} 
 Print (a [1] [1]) 
 Print (a [1] [2]) 
 Print (a [1] [3]) 
 Print (a [2] [1]) 
 Print (a [2] [2]) 
 Print (a [2] [3]) 
 -This traversal 
 Print ("************** i Ipairs iteration traversing the key value ************************** 
 a = {[0] = 1,2, [-1] = 3,4,5} 
 -The key value 
 for, k in ipairs (a) do 
 Print ("IPAIRS traversal key" ..i) 
 Print ("IPAIRS Value" ..k) 
 end 
 Print ("************** Pairs iteration to traverse the key value ********************* 
 for, k in pairs (a) do 
 Print ("PAIRS Traversing Key" ..i) 
 Print ("PAIRS Pasting Value" ..k) 
 end 
 Print ("************** to iterate through the traversal key ****************** 
 -The traversal key 
 for I in Pairs (a) do 
 Print ("key" ..i) 
 end 
 Print ("************** Dictionary ********************** 
 a = {[1 "] = 5, [2"] = 4} 
 Print (a [1 "]) 
 Print (a [2 "]) 
 Print ("************** class *********************** 
 Student = {{ 
 	--age 
 Age = 1, 
 	--gender 
 sex = 0, 
 --UNITY score 
 Unity = 90, 
 -Howing behavior 
 Up = FUNCTION (Self) 
 Self.age = Self.age + 1 
 Print ("I grew up" ..Self.age) 
 end, 
 -Class behavior 
 Learn = fuins () () 
 Print ("Learning") 
 end 
 } 

 Student.learn () 
 Student.up (Student) 
 student: up () 
 --student.learn () 
 Student.age = 2 
 Print (Student.age) 

 Print ("*************** special usage ***************") 
 A, B, C = 1,2,3,4 -4 will be ignored 
 Print (a) 
 Print (b) 
 Print (C) 
 A, B, C = 1,2 -C will become nil 
 Print (a) 
 Print (b) 
 Print (C) 

 -We multiple returns 
 function test () 
 Return 10,20,30,40 
 end 

 A, b, c = test () 
 Print (a) 
 Print (b) 
 Print (C)

source

Related Posts

SDUT minimum intercept system Guojing

qt configuration system new project function

1 1 1 1 1 1 1 10benben

POJ3006, Dirichlet’s theorem on Arithmetic Progressions, Di Likrey theorem.

Set up LAMP services (Apache, MySQL, PHP)

Random Posts

ROS Study Notes Report Error (1): Publisher and Subscriper’s programming implementation error solution

linux GDB tool Kamu

List collection The same object (one or more attributes) in the collection of attributes returns the list and is sorted and output PSY according to the object attribute

Sorting method (C ++)

neural network and deep learning notes (3) The activation function and parameter initialization