#在Lua中是什么意思? [英] What does # mean in Lua?
本文介绍了#在Lua中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Lua中,我已经看到很多哈希字符'#'被添加到变量的前面.
I have seen the hash character '#' being added to the front of variables a lot in Lua.
它是做什么的?
示例
-- sort AIs in currentlevel
table.sort(level.ais, function(a,b) return a.y < b.y end)
local curAIIndex = 1
local maxAIIndex = #level.ais
for i = 1,#currentLevel+maxAIIndex do
if level.ais[curAIIndex].y+sprites.monster:getHeight() < currentLevel[i].lowerY then
table.insert(currentLevel, i, level.ais[curAIIndex])
curAIIndex = curAIIndex + 1
if curAIIndex > maxAIIndex then
break
end
end
end
很抱歉,如果已经问过这个问题,我已经在互联网上搜索了很多,但似乎还没有找到答案.预先感谢!
Apologies if this has already been asked, I've searched around on the internet a lot but I haven't seem to have found an answer. Thanks in advance!
推荐答案
查看全文