Biopsy

matrix 2.0

May 16th, 2012
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.41 KB | None | 0 0
  1. function create()
  2.   new = {}
  3.   return new
  4. end
  5.  
  6. function set(array, x, y, value)
  7.   index = x..":"..y
  8.   array[index] = value
  9. end
  10.  
  11. function get(array, x, y)
  12.   index = x..":"..y
  13.   return array[index]
  14. end
  15.  
  16. function remove(array, x, y)
  17.   index = x..":"..y
  18.   array[index] = nil
  19. end
  20.  
  21. function size(array)
  22.   numItems = 0
  23.   for k,v in pairs(array) do
  24.     numItems = numItems + 1
  25.   end
  26.   return(numItems)
  27. end
Advertisement
Add Comment
Please, Sign In to add comment