Lua escape character

[1] Lua language in the Windows environment, file path wording

Example procedures are as follows:

 1 -- test1
 2 local file = io.open("E:\test\100.txt", 'rb')
 3 if not file then
 4     print('test1::invalid')
 5 else
 6     print('test1::ok')
 7 end
 8 
 9 -- test2
10 file = io.open("E:\\test\\200.txt", 'rb')
11 if not file then
12     print('test2::invalid')
13 else
14     print('test2::ok')
15 end
16 
17 -- test3
18 file = io.open("E:/test/300.txt", 'rb')
19 if not file then
20     print(':: invalid Test3 ' )
 21 is  the else 
22 is      Print ( ' Test3 :: OK ' )
 23 is  End 
24  
25  - Demo 
26 is  Print ( ' \\ ' );     - backslach single slash 
27  Print ( " \" " );     - - double double quote marks 
28  Print ( " \" \ " " );   - double double quote marks 
29  Print ( " \ ' ");     - SINGLE single quote marks 
30  Print ( " '' " );     - SINGLE single quote marks 
31 is  Print ( " \ [ " );     - left Square Bracket left bracket 
32  Print ( " \] " );     - - right Square Bracket

Results of the:

test1::invalid
test2::ok
test3::ok
\
"
""
'
''
[
]

As shown above.

[2] summary

(1) Linux System: Linux using the slash / as the path separator.

(2) Network Address: the web application by using the above system Linux, the current network addresses are used slash / as a delimiter.

(3) Windows System: Windows uses the backslash \ as the path separator.

(4)相对路径:相对于当前文件的路径;绝对路径:主页上的文件或目录在硬盘上的真正路径。     

(5)几个特殊符号:

./:代表目前所在的目录。

../:代表上一层目录。

(6)Lua语言中,斜杠\为转义字符。

转义字符用于表示不能直接显示的字符,比如后退键,回车键等,如在字符串转换双引号可以使用 " \" "。

两个转义字符所对应的意义:两个\\代表一个\

good good study, day day up.

顺序 选择 循环 总结

Guess you like

Origin www.cnblogs.com/Braveliu/p/11919561.html