Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "20.0802.R1"
- local ramCesta = "/C/system/RAM/devices/"
- local modemy={}
- local modemNum=0
- local pocitace={}
- local pocitaceNum=0
- local repro={}
- local reproNum=0
- local drive={}
- local driveNum=0
- local monitor={}
- local monitorNum=0
- local tisk={}
- local tiskNum=0
- function save(table,name)
- local file = fs.open(ramCesta..""..name,"w")
- file.write(textutils.serialize(table))
- file.close()
- end
- function evidence()
- if modemNum > 0 then
- save(modemy,"modem.tmp")
- end
- if pocitaceNum > 0 then
- save(pocitace,"computer.tmp")
- end
- if driveNum > 0 then
- save(drive,"drive.tmp")
- end
- if monitorNum > 0 then
- save(monitor,"monitor.tmp")
- end
- if tiskNum > 0 then
- save(tisk,"printer.tmp")
- end
- if reproNum > 0 then
- save(repro,"speaker.tmp")
- end
- end
- function hodnot()
- if typ_zar == "modem" then
- modemNum = modemNum + 1
- modemy[modemNum] = pozice
- elseif typ_zar == "computer" then
- pocitaceNum = pocitaceNum + 1
- pocitace[pocitaceNum] = pozice
- elseif typ_zar == "drive" then
- driveNum = driveNum + 1
- drive[driveNum] = pozice
- elseif typ_zar == "monitor" then
- monitorNum = monitorNum + 1
- monitor[monitorNum] = pozice
- elseif typ_zar == "printer" then
- tiskNum = tiskNum + 1
- tisk[tiskNum] = pozice
- elseif typ_zar == "speaker" then
- reproNum = reproNum + 1
- repro[tiskNum] = pozice
- end
- end
- function rozpoznat()
- local q = 0
- repeat
- q = q+1
- hledej = string.sub(device,q,q)
- if (hledej==" ") then
- typ_zar = string.sub(device,1,q-1)
- pozice = string.sub(device,q+1,#device)
- hodnot()
- q = #device
- end
- until q == #device
- cist()
- end
- function cist()
- device = data.readLine()
- if device == nil then
- evidence()
- data.close()
- else
- rozpoznat()
- end
- end
- local periList = peripheral.getNames()
- local s = fs.open (ramCesta.."All.tmp","w")
- for i = 1, #periList do
- s.writeLine(peripheral.getType(periList[i]).." "..periList[i])
- end
- s.close()
- data = fs.open (ramCesta.."All.tmp","r")
- cist()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement