Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(not os.loadAPI("hydraApi")) then
- error("Could not load hydraApi")
- end
- local bridge = hydraApi.getMeBridge()
- local list = bridge.listItems()
- local handle = fs.open("itemmap.txt", "r")
- if(handle == nil) then
- itemMap = {}
- else
- itemMap = textutils.unserialize(handle.readAll())
- handle.close()
- if(itemMap == nil) then
- itemMap = {}
- end
- end
- for k,v in pairs(list) do
- if(itemMap[k] == nil) then
- itemMap[k] = v
- end
- end
- local handle = fs.open("itemmap.txt", "w")
- local str = textutils.serialize(itemMap)
- str = string.gsub(str, ",%[",",\n%[")
- handle.write(str)
- handle.close()
Add Comment
Please, Sign In to add comment