Vincent38190

Minechem_computercraft

Apr 27th, 2019
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.91 KB | None | 0 0
  1. ae = peripheral.wrap("back")
  2.  
  3. local function getName(name)
  4.     local test = false
  5.     local rep = ""
  6.     for i in string.gmatch(name,'.') do
  7.         if i == '.' then test = true end
  8.         if test then rep = rep .. i end
  9.     end
  10.     return rep
  11. end
  12.  
  13. local function listElement()
  14.     local rep = {}
  15.     for i,j in pairs(ae.listItems()) do
  16.         if j["name"] == 'minechem:minechemElement' then
  17.             table.insert(rep,{["name"]=getName(j['displayName']),["numatom"]=j['meta'],["amount"]=j['amount']})
  18.         end
  19.     end
  20.     return rep
  21. end
  22.  
  23.  
  24. local function listMolecule()
  25.     local rep = {}
  26.     for i,j in pairs(ae.listItems()) do
  27.         if j["name"] == 'minechem:minechemMolecule' then
  28.             table.insert(rep,{["name"]=getName(j['displayName']),["meta"]=j['meta'],["amount"]=j['amount']})
  29.         end
  30.     end
  31.     return rep
  32. end
  33.  
  34. -- TESTING
  35.  
  36. for i in listElement() do
  37.     print(i)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment