changeset 101:25c127c4c1e8

Cleanup. Notes. Always use ipairs on changes table - no guarantee of ordering with pairs
author John@Doomsday
date Thu, 03 May 2012 09:04:51 -0400
parents 790266dbcaff
children 21567b74fcc7
files Lists.lua
diffstat 1 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Lists.lua	Thu May 03 09:04:21 2012 -0400
+++ b/Lists.lua	Thu May 03 09:04:51 2012 -0400
@@ -929,7 +929,7 @@
         local j = 1 -- index in foreign list
         local n = getn(t)
         local o = {}
-        for i,v in pairs(db.profile.changes) do -- for each timestamp in our list
+        for i,v in ipairs(db.profile.changes) do -- for each timestamp in our list
             if t and t[j] < v.time then
                 table.insert(o,v)
             end
@@ -937,9 +937,6 @@
         end -- j>=n ? add because the remote hit end of road. lt? add because it's a missing stamp
         --print("Received request at timebase",remoteBase,"and returning:")
         --PrintTable(o)
-        if getn(o) > 0 then
-            Send("CU",o) -- todo: send privately to the requster
-        end
         return true, o
     else
         return false, {}
@@ -962,7 +959,7 @@
         db.profile.changes = c
     else
         while op <= no or cp <= nc do -- lists are pre-sorted. insertion merge them
-            if cp > nc then -- inelegant
+            if cp > nc then -- inelegant - edge cases first, then the normal logic
                 table.insert(new,old[op])
                 op = op + 1
             elseif op > no then