Diff

core/storagemanager.lua @ 7157:0890a428a99b

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 10 Feb 2016 07:57:58 +0100
parent 6952:db085e55555f
parent 7152:ca64255bf7cd
child 7245:210d8329dc70
line wrap: on
line diff
--- a/core/storagemanager.lua	Mon Feb 08 21:50:04 2016 +0000
+++ b/core/storagemanager.lua	Wed Feb 10 07:57:58 2016 +0100
@@ -118,6 +118,23 @@
 			current[key] = data;
 			return self.keyval_store:set(username, current);
 		end;
+		set_keys = function (self, username, keydatas)
+			local current, err = self.keyval_store:get(username);
+			if current == nil then
+				if err then
+					return nil, err;
+				else
+					current = keydatas;
+				end
+			else
+				for k,v in pairs(keydatas) do
+					if v == self.remove then v = nil; end
+					current[k] = v;
+				end
+			end
+			return self.keyval_store:set(username, current);
+		end;
+		remove = {};
 	};
 }