Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI('json')
- --test reading nad writing the buildzones grid to a file
- --creates a grid of absolute references (0,0) (1,0)
- function buildGrid(w,h)
- local grid = {}
- for x=0,w-1 do
- for z=0,h-1 do
- table.insert(grid,{x=x,z=z,played=false})
- end
- end
- return grid
- end
- local LOCS = buildGrid(11,27)
- fs.makeDir("/records")
- local filename = "/records/_buildzones-list.yaml"
- local file = fs.open(filename,"w")
- file.write(json.encodePretty(LOCS))
- file.close()
- local newLOCS = json.decodeFromFile(filename)
- print(newLOCS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement