print("\a"); --bell 硬件滴一声
print("a");
print("\b"); --back space 空格
print("b");
print("\f"); --from feed填充表格
print("\n"); --new line换行
print("\r"); --carriage reurn返回当前行第一列
print("\t"); --horizontal tab 水平换行
print("\v"); --填充表格
print("\\"); --backslach单斜杠
print("\""); --double quote双引号
print("\'"); --single quote单引号
print("\["); --left square bracket左中括号
print("\]"); --right square bracket
---------------------------------------------
print("one line\nnext line\n\"in quote\",\'in quotes\'");
print("''"); --可以
--print("" ""); --不可以
print("\"\""); --必须转意字符
---------------照原样输出-----------------------------------
page = [[
\n\tttt\nn\yy
<.>
<>
<>
hh
]];
print(page);
io.write(page); --用这种方法忽略转意字符按原样输出
--------------------lua的智能----------------------
print(10 .. 20); --..操作符必须加空格
print("10"+1);
print("10+1");
line = io.read();
n= tonumber(line); --将读入的数据强制转换为number
if n == nil then
error(line .. " is vaild number");
else
print(n*2);
end
print(tostring(10) == "10");
print(1 .. 0 == "10");
print(10 .. "" == "10"); --数字和字符串..为字符串"10"
print("10"+1 == 11); --数字和字符串+ 为数字11
print(4 and 5); --第一个为真第二个也为真 则输出第二个a and b -->如果a为false 则返回a 否则返回b
a or b -->如果a为true则返回a 否则返回b
and 优先级比 or高
x = x or v;
==>
if not x then
x=v;
end