Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local version = "1.24" --change this to allow for an update (3 chars only)
- local filename = "react" --change this to the name of the file holding this program
- local paste = "y1hvbQ4y" --change this to the pastebin entry code
- local function update()
- local url = "http://pastebin.com/raw/"..paste
- local temp = http.get(url)
- local ver = string.sub(temp.readLine(), 18, 21)
- print(version..":"..ver)
- if ver ~= version then
- fs.delete(filename)
- shell.run("pastebin get "..paste.." "..filename)
- shell.run(filename)
- return true
- end
- return false
- end
- --start
- if update() then
- error()
- end
- shell.run("clear")
- --not mine
- local function split(str)
- local t = {} -- NOTE: use {n = 0} in Lua-5.0
- local fpat = "(.-)" .. ":" --character to use
- local last_end = 1
- local s, e, cap = str:find(fpat, 1)
- while s do
- if s ~= 1 or cap ~= "" then
- table.insert(t,cap)
- end
- last_end = e+1
- s, e, cap = str:find(fpat, last_end)
- end
- if last_end <= #str then
- cap = str:sub(last_end)
- table.insert(t, cap)
- end
- return t
- end
- --suck contents
- turtle.select(1)
- while turtle.suck() ~= false do end
- --print details of each item in order
- local slot = 1
- h = fs.open("contents","w")
- while turtle.getItemDetail(slot) ~= nil do
- local item = turtle.getItemDetail(slot)
- local name = split(item.name)
- h.writeLine(name[1])
- h.writeLine(name[2])
- h.writeLine(item.count)
- h.writeLine("")
- slot = slot + 1
- end
- h.close()
- --return contents
- for slot=1,16,1 do
- turtle.select(slot)
- turtle.drop()
- end
- turtle.select(1)
Add Comment
Please, Sign In to add comment