Lua 中的词汇标记
Lexical tokens in Lua
来自文档
以下字符串表示其他标记:
+ - * / % ^ #
== ~= <= >= < > =
( ) { } [ ]
; : , . .. ...
# 和 ... 是什么意思?
#
是 length operator and ...
is a variable argument (vararg) expression.
#
符号用于获取集合(数组、字符串等)的长度
items = {"a", "b", "c", "d"}
print(#items) -- 4
...
符号表示函数的参数个数可变
function print (...)
for i,v in ipairs(arg) do
result = result .. tostring(v) .. "\t"
end
end
来自文档
以下字符串表示其他标记:
+ - * / % ^ #
== ~= <= >= < > =
( ) { } [ ]
; : , . .. ...
# 和 ... 是什么意思?
#
是 length operator and ...
is a variable argument (vararg) expression.
#
符号用于获取集合(数组、字符串等)的长度
items = {"a", "b", "c", "d"}
print(#items) -- 4
...
符号表示函数的参数个数可变
function print (...)
for i,v in ipairs(arg) do
result = result .. tostring(v) .. "\t"
end
end