Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- AutoUpdater v1.1 by Hoolaf for ComputerCraft
- os.loadAPI ("//lib/updates/src")
- src = src.init()
- Updater = { src = src }
- Updater.mt = { }
- function Updater:new ()
- local updater = Updater
- setmetatable(updater, Updater.mt)
- return updater
- end
- function Updater:expandTable (table)
- for k, v in pairs(table) do
- if type(v) == "string" then
- Updater[k] = v
- end
- if type(v) == "table" then
- for key, val in pairs(v) do
- Updater[key] = val
- end
- end
- end
- return Updater
- end
- function Updater:update (mode)
- Updater = Updater:expandTable(Updater.src.getTable(mode))
- if turtle == false then
- tbl = Updater.src.getTable("turtle")
- for k, v in pairs(Updater) do
- for key, val in pairs(tbl) do
- if tostring(key) == tostring(k) then k = nil end
- end
- end
- end
- for k, v in pairs(Updater) do
- if type(v) == "string" then
- dir = "//" .. string.gsub(tostring(k), "_", "/")
- didPaste = shell.run("pastebin", "get", v, dir)
- end
- end
- end
- updater = Updater:new()
- return updater
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement