Jon*_*azo 29 lua comments multiline
我试图找到一种方法来对一批代码使用多行注释,但是它一直把它中的一些语法误认为是]]并且我想它要结束那里,我不这样做!
--[[
for k,v in pairs(t) do
local d = fullToShort[k]
local col = xColours[v[1]] -- It stops here!
cecho(string.format(("<%s>%s ", col, d))
end
--]]
Run Code Online (Sandbox Code Playgroud)
我以为我在某个地方读过可以使用不同的组合来避免这些错误,比如 - [= [或诸如此类的......有人可以帮忙吗?
Sea*_*ull 53
正如你在Strings教程中看到的那样[===[,嵌套方括号有一种特殊的语法.您也可以在块注释中使用它.请注意,=开启和关闭序列中的符号数必须相同.
例如,5等于将起作用.
--[=====[
for k,v in pairs(t) do
local d = fullToShort[k]
local col = xColours[v[1]] -- It stops here!
cecho(string.format(("<%s>%s ", col, d))
end
--]=====]
Run Code Online (Sandbox Code Playgroud)