Comparison

core/storagemanager.lua @ 7244:8c6943918279

storagemanager: Fix saving data in map shim when no prior data exists
author Kim Alvefur <zash@zash.se>
date Sun, 06 Mar 2016 18:51:11 +0100
parent 7152:ca64255bf7cd
child 7245:210d8329dc70
child 7325:7baf1b14defb
comparison
equal deleted inserted replaced
7241:5e7797822f19 7244:8c6943918279
121 set_keys = function (self, username, keydatas) 121 set_keys = function (self, username, keydatas)
122 local current, err = self.keyval_store:get(username); 122 local current, err = self.keyval_store:get(username);
123 if current == nil then 123 if current == nil then
124 if err then 124 if err then
125 return nil, err; 125 return nil, err;
126 else
127 current = keydatas;
128 end 126 end
129 else 127 current = {};
130 for k,v in pairs(keydatas) do 128 end
131 if v == self.remove then v = nil; end 129 for k,v in pairs(keydatas) do
132 current[k] = v; 130 if v == self.remove then v = nil; end
133 end 131 current[k] = v;
134 end 132 end
135 return self.keyval_store:set(username, current); 133 return self.keyval_store:set(username, current);
136 end; 134 end;
137 remove = {}; 135 remove = {};
138 }; 136 };