Advertisement
lavalevel

Searching for a location with in Pairs

Jan 11th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.06 KB | None | 0 0
  1.         cells = {}
  2.  
  3.  
  4.         cells[1] = { assigned = "a", location = 69 }
  5.         cells[2] = { assigned = "b", location = 71 }
  6.         cells[3] = { assigned = "c", location = 73 }
  7.         cells[4] = { assigned = "d", location = 75 }
  8.  
  9.         cells[5] = { assigned = "e", location = 101 }
  10.         cells[6] = { assigned = "f", location = 103 }
  11.         cells[7] = { assigned = "j", location = 105 }
  12.         cells[8] = { assigned = "h", location = 107 }
  13.  
  14.         cells[9] = { assigned = "i", location = 133 }
  15.         cells[10] = { assigned = "j", location = 135 }
  16.         cells[11] = { assigned = "j", location = 137 }
  17.         cells[12] = { assigned = "l", location = 139 }
  18.  
  19.         cells[13] = { assigned = "m", location = 165 }
  20.         cells[14] = { assigned = "n", location = 167 }
  21.         cells[15] = { assigned = "o", location = 169 }
  22.         cells[16] = { assigned = "p", location = 171 }
  23.  
  24. -- I know how to do this with for i=1, #cells do if cells[i].location==133 then cellToEdit=i;end;end
  25.  
  26. --but now I want to use ipairs to locate the one with location 133.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement