Advertisement
Guest User

table confusion

a guest
Oct 20th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. --love.load
  2. xy = {}
  3. table.insert(xy, {x = 200, y = 200})
  4. table.insert(xy, {x = 600, y = 200})
  5. table.insert(xy, {x = 600, y = 400})
  6. table.insert(xy, {x = 200, y = 400})
  7.    
  8. linur = {}
  9.  
  10. --love.update
  11.  
  12. for i = 1, 4 do
  13.     linur[i].nalaegd = pyth(mx, xy[i].x, my, xy[i].y)
  14. end
  15.  
  16. function pyth(x1, x2, y1, y2)
  17.     return math.sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2))
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement