layer count.lua

来自「J2ME游戏地图编辑器。不错」· LUA 代码 · 共 37 行

LUA
37
字号
-- Layer Count

lnum = 0

function main ()
 local w = mappy.getValue(mappy.MAPWIDTH)
 local h = mappy.getValue(mappy.MAPHEIGHT)

 if (w == 0) then
  mappy.msgBox ("Layer Count", "You need to load or create a map first", mappy.MMB_OK, mappy.MMB_ICONINFO)
 else

  mappy.msgBox ("Layer Count", "Number of layers in map = "..lnum, mappy.MMB_OK, mappy.MMB_ICONINFO)

 end
end

function countlayer ()
 mappy.getBlock(0,0,lnum)
end

while 1 do
 lnum = lnum + 1
 test, errormsg = pcall( countlayer )
 if not test then
  break
 end
 if (lnum == 8) then
  break;
 end
end

test, errormsg = pcall( main )
if not test then
    mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?