Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- use with https://pastebin.com/26SS7P04
- local menu, T
- function checkLabel()
- if os.getComputerLabel() == nil then
- os.setComputerLabel("toolkit")
- print("Computer label set to "..os.getComputerLabel())
- end
- end
- function checkLibs(libDir, filename)
- local fileExists = false
- if fs.exists(libDir) then
- if not fs.isDir(libDir) then
- fs.move(libDir, libDir.."Renamed")
- fs.makeDir(libDir)
- end
- else
- fs.makeDir(libDir)
- end
- if fs.exists(fs.combine(libDir, filename)) or fs.exists(fs.combine(libDir, filename..".lua")) then
- fileExists = true
- end
- return fileExists
- end
- function main()
- local doContinue = true
- checkLabel() -- make sure turtle label is set
- --check if lib folder exists
- if not checkLibs("lib", "clsTurtleTutorial") then
- print("Missing clsTurtle.lua in libs directory")
- doContinue = false
- -- or use pastebin get to download clsTurtle to libs folder
- end
- if not checkLibs("lib", "menu") then
- print("Missing menu.lua in libs directory")
- doContinue = false
- -- or use pastebin get to download menu.lua to libs folder
- end
- if doContinue then
- menu = require("lib.menu") --note alternative method of sub-folder
- T = require("lib/clsTurtleTutorial").new("Tutorial Turtle")
- print("My name is "..T:getName())
- print("Thank you for using 'survival toolkit'")
- else
- print("Add missing files and restart")
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement