iteration
This commit is contained in:
		@ -1,4 +1,5 @@
 | 
				
			|||||||
local cache = {}
 | 
					local cache = {}
 | 
				
			||||||
 | 
					local cache_file = "/var/cache/lns_cache.db"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
settings.define("lns_client.allow_dynamic_lns_hosts", {
 | 
					settings.define("lns_client.allow_dynamic_lns_hosts", {
 | 
				
			||||||
    description = "Allow dynamic LNS hosts",
 | 
					    description = "Allow dynamic LNS hosts",
 | 
				
			||||||
@ -14,8 +15,8 @@ settings.define("lns_client.lns_server", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _load_cache()
 | 
					function _load_cache()
 | 
				
			||||||
    if fs.exists("lns_cache.db") then
 | 
					    if fs.exists(cache_file) then
 | 
				
			||||||
        db = fs.open("lns_cache.db", "r")
 | 
					        db = fs.open(cache_file, "r")
 | 
				
			||||||
        db_contents = db.readAll()
 | 
					        db_contents = db.readAll()
 | 
				
			||||||
        db.close()
 | 
					        db.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -24,7 +25,7 @@ function _load_cache()
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function _save_cache()
 | 
					function _save_cache()
 | 
				
			||||||
    db = fs.open("lns_cache.db", "w")
 | 
					    db = fs.open(cache_file, "w")
 | 
				
			||||||
    db.write(textutils.serialize(cache))
 | 
					    db.write(textutils.serialize(cache))
 | 
				
			||||||
    db.close()
 | 
					    db.close()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user