Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- формируем список list.txt для обменника руды by serafim
- -- https://i.imgur.com/hFpJm3Y.png
- local com = require("component")
- local chest = com.isAvailable("chest") and com.chest or error("нет сундука")
- local info,ore_dict,tact,index_2 = "","",true,0
- local file = io.open("/home/list.txt", "a")
- local size = chest.getInventorySize()
- local data = chest.getAllStacks(0)
- local index_1 = 0
- for slot = 1,size do
- if data[slot] then
- index_1 = index_1 + 1
- end
- end
- for slot = 1,size do
- if data[slot] then
- index_2 = index_2 + 1
- if tact then
- local name = ""
- if string.find(data[slot].id,"IC2") then
- name = "IC2 "
- elseif string.find(data[slot].id,"Thermal") then
- name = "TE "
- elseif string.find(data[slot].id,"Draconic") then
- name = "DE "
- end
- info = ' {"2","'..name..data[slot].display_name..'","'..data[slot].id..'","'..data[slot].dmg..'","'
- else
- if data[slot].ore_dict then
- for k, v in pairs(data[slot].ore_dict) do
- ore_dict = k
- end
- info = info..data[slot].id..'","'..data[slot].dmg..'","'..data[slot].display_name..'","'..ore_dict
- else
- info = info..data[slot].id..'","'..data[slot].dmg..'","'..data[slot].display_name
- end
- if index_1 == index_2 then
- info = info..'"}'
- else
- info = info..'"},'.."\n"
- end
- file:write(info)
- end
- tact = not tact
- end
- end
- file:close()
- -- os.execute("edit list.txt")
- -- os.execute("pastebin put list.txt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement