equal
deleted
inserted
replaced
40 end |
40 end |
41 |
41 |
42 local archive_store = {}; |
42 local archive_store = {}; |
43 archive_store.__index = archive_store; |
43 archive_store.__index = archive_store; |
44 |
44 |
45 function archive_store:append(username, key, when, with, value) |
45 function archive_store:append(username, key, value, when, with) |
|
46 if type(when) ~= "number" then |
|
47 value, when, with = when, with, value; |
|
48 end |
46 local a = self.store[username]; |
49 local a = self.store[username]; |
47 if not a then |
50 if not a then |
48 a = {}; |
51 a = {}; |
49 self.store[username] = a; |
52 self.store[username] = a; |
50 end |
53 end |
114 local t; |
117 local t; |
115 for i = 1, #old do |
118 for i = 1, #old do |
116 i = old[i]; |
119 i = old[i]; |
117 t = i.when; |
120 t = i.when; |
118 if not(qstart >= t and qend <= t and (not qwith or i.with == qwith)) then |
121 if not(qstart >= t and qend <= t and (not qwith or i.with == qwith)) then |
119 self:append(username, i.key, t, i.with, i.value); |
122 self:append(username, i.key, i.value, t, i.with); |
120 end |
123 end |
121 end |
124 end |
122 if #new == 0 then |
125 if #new == 0 then |
123 self.store[username] = nil; |
126 self.store[username] = nil; |
124 end |
127 end |