Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local my = {}
- function my.hello()
- print("hello")
- end
- local robot = require("robot")
- local json = require("json")
- local filesystem = require("filesystem")
- local args = {...}
- local saveFile = "navPos.txt"
- local position = {1, 2, 1}
- local this = {}
- function this.load()
- local f = io.open(saveFile, "r")
- if f == nil then
- print("Save file not found")
- return
- end
- local encoded = f:read()
- local position = json.decode(encoded)
- f:close()
- print("Loaded position: "..encoded)
- end
- function this.save()
- local f = io.open(saveFile, "w")
- local encoded = json.encode(position)
- f:write(encoded)
- f:close()
- print("Saved position: "..encoded)
- end
- function my.forward(count)
- for i=0,count do
- robot.forward()
- end
- end
- return my
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement