Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local storage = peripheral.wrap("right")
- local glass = peripheral.wrap("left")
- --not mine
- function mysplit(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={} ; i=1
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t[i] = str
- i = i + 1
- end
- return t
- end
- function find(search)
- local all = storage.getAvailableItems()
- local count = 10
- glass.clear()
- for num, item in pairs(all) do
- local fing = item.fingerprint
- local num = item.size
- local id = fing.id
- local idTable = mysplit(id, ":")
- local sTable = mysplit(search, ":")
- if sTable[1] == "all" then
- if string.find(idTable[2], sTable[2]) then
- glass.addText(1, count, idTable[2]..": "..num)
- count = count + 10
- end
- else
- if string.find(idTable[1], sTable[1]) and string.find(idTable[2], sTable[2]) then
- glass.addText(1, count, idTable[2]..": "..num)
- count = count + 10
- end
- end
- end
- glass.sync()
- end
- while true do
- local event, player, side, command = os.pullEvent("glasses_chat_command")
- find(command)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement