?login_element?

Subversion Repositories NedoOS

Rev

Blame | Last modification | View Log | Download

  1. -- Swap layers
  2.  
  3. function main ()
  4.  local w = mappy.getValue(mappy.MAPWIDTH)
  5.  local h = mappy.getValue(mappy.MAPHEIGHT)
  6.  
  7.  if (w == 0) then
  8.   mappy.msgBox ("Swap layers", "You need to load or create a map first", mappy.MMB_OK, mappy.MMB_ICONINFO)
  9.  else
  10.  
  11.   local isok,index1,index2 = mappy.doDialogue ("Swap layers", "Enter layer numbers:", "0,1", mappy.MMB_DIALOGUE2)
  12.   if isok == mappy.MMB_OK then
  13.    mappy.copyLayer(index1, mappy.MPY_UNDO)
  14.    mappy.copyLayer(index2, index1)
  15.    mappy.copyLayer(mappy.MPY_UNDO, index2)
  16.   end
  17.  end
  18. end
  19.  
  20. test, errormsg = pcall( main )
  21. if not test then
  22.     mappy.msgBox("Error ...", errormsg, mappy.MMB_OK, mappy.MMB_ICONEXCLAMATION)
  23. end
  24.