Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local arg1 = ...
- local id = {}
- local meta = {}
- local name = {}
- local files = {[1]="dump"}
- local i = 0
- local dictionary = {}
- for x=1,#files do
- local file = fs.open(files[x],"r")
- repeat
- i=i+1
- local line = file:readLine()
- id[i] = line
- line = file:readLine()
- meta[i] = line
- line = file:readLine()
- name[i] = line
- until not line
- end
- local table = {["id"]=id,["meta"]=meta,["name"]=name}
- local search = arg1
- local idlist = ""
- local recursionCheck = ""
- for i=1,#table["id"] do
- --dictionary[table["id"][i].."~"..table["meta"][i]]=table["name"][i]
- if string.find(string.upper(table["name"][i]),string.upper(search)) then
- idlist = idlist..table["id"][i].."~"..table["meta"][i].." "
- end
- end
- local file = fs.open("idlist","w")
- file.write(idlist)
- file.close()
- --file = fs.open("dictionary","w")
- --file.write(textutils.serialise(dictionary))
- --file.close()
- local me = peripheral.wrap("left")
- local available = me.getAvailableItems()
- local id = {}
- local meta = {}
- local size = {}
- local table = {["id"]=id,["meta"]=meta,["size"]=size}
- for i,table in pairs(available) do
- for k,item in pairs(table) do
- if(k=="size" or k=="fingerprint") then
- if type(item) == "table" then
- id[i]=item["id"]
- meta[i]=item["dmg"]
- else
- size[i]=item
- end
- end
- end
- end
- local file = fs.open("idlist","r")
- local idlist = file.readAll()
- file.close()
- file = fs.open("dictionary","r")
- local dictionary = textutils.unserialise(file.readAll())
- file.close()
- for i=1,#table["id"] do
- local idstring = table["id"][i].."~"..table["meta"][i]
- if string.find(idlist,idstring) then
- print(dictionary[idstring].." x "..table["size"][i])
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement