Advertisement
dalvorsn

Untitled

Apr 26th, 2012
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. function Xadrez:getPiecesOnTab()
  2.     local black, white = {}, {}
  3.     for x = 0, 7 do
  4.         for y = 0, 7 do
  5.             pos.x, pos.y, pos.z = INITIAL_POS.x, INITIAL_POS.y, INITIAL_POS.z
  6.             pos.x, pos.y = pos.x + x, pos.y + y
  7.             local creature = getTopCreature(pos)
  8.             if(isCreature(creature.uid) and (not isPlayer(creature.uid)))then
  9.                 local name = getCreatureName(creature.uid)
  10.                 if(self:isPiece(name))then
  11.                     table.insert((name:find("black") and black or white), creature.uid)
  12.                 end
  13.             end
  14.         end
  15.     end
  16.     return black, white
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement