mod_storage_memory: Fix overwriting old keys
Test fixed is: spec/core_storagemanager_spec.lua:309: Expected objects to be equal.
--- a/plugins/mod_storage_memory.lua Sun Oct 21 17:58:50 2018 +0200
+++ b/plugins/mod_storage_memory.lua Sun Oct 21 18:00:46 2018 +0200
@@ -53,7 +53,6 @@
a = {};
self.store[username or NULL] = a;
end
- local i = #a+1;
local v = { key = key, when = when, with = with, value = value };
if not key then
key = tostring(a):match"%x+$"..tostring(v):match"%x+$";
@@ -62,6 +61,7 @@
if a[key] then
table.remove(a, a[key]);
end
+ local i = #a+1;
a[i] = v;
a[key] = i;
return key;