Advertisement
antonsavov

Untitled

Mar 6th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. os.loadAPI('json')
  2.  
  3. --test reading nad writing the buildzones grid to a file
  4. --creates a grid of absolute references (0,0) (1,0)
  5. function buildGrid(w,h)
  6. local grid = {}
  7. for x=0,w-1 do
  8. for z=0,h-1 do
  9. table.insert(grid,{x=x,z=z,played=false})
  10. end
  11. end
  12. return grid
  13. end
  14.  
  15. LOCS = buildGrid(11,27)
  16.  
  17. fs.makeDir("/records")
  18.  
  19. local file = fs.open("/records/_buildzones-list.yaml","w")
  20. file.write(json.encodePretty(LOCS))
  21. file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement