# HG changeset patch # User Kim Alvefur # Date 1540137646 -7200 # Node ID b301f7edf34601ad5d346e2f6eb76a15d5267f9a # Parent 00a8e627854e3cef25fdfbc72694123b19906641 mod_storage_memory: Fix overwriting old keys Test fixed is: spec/core_storagemanager_spec.lua:309: Expected objects to be equal. diff -r 00a8e627854e -r b301f7edf346 plugins/mod_storage_memory.lua --- 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;