Advertisement
Guest User

test

a guest
Oct 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local arg1 = ...
  2. local me = peripheral.wrap("left")
  3. local available = me.getAvailableItems()
  4. local id = {}
  5. local meta = {}
  6. local size = {}
  7. local table = {["id"]=id,["meta"]=meta,["size"]=size}
  8.  
  9. for i,table in pairs(available) do
  10.   for k,item in pairs(table) do
  11.     if(k=="size" or k=="fingerprint") then
  12.       if type(item) == "table" then
  13.         id[i]=item["id"]
  14.         meta[i]=item["dmg"]
  15.       else
  16.         size[i]=item
  17.       end
  18.     end
  19.   end
  20. end
  21.  
  22. shell.run(csv,arg1)
  23.  
  24. local file = fs.open("idlist","r")
  25. local idlist = file.readAll()
  26. file.close()
  27. file = fs.open("dictionary","r")
  28. local dictionary = textutils.unserialise(file.readAll())
  29. file.close()
  30.  
  31. for i=1,#table["id"] do
  32.   local idstring = table["id"][i].."~"..table["meta"][i]
  33.   if string.find(idlist,idstring) then
  34.     print(dictionary[idstring].." x "..table["size"][i])
  35.   end
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement