move timestamp function to the top of the data module so that it can be made private

This commit is contained in:
Bart Van Der Meerssche 2010-04-21 00:32:02 +02:00
parent ed4e01ce8d
commit 2b1e3248b2
1 changed files with 8 additions and 7 deletions

View File

@ -29,6 +29,14 @@ local getfenv, setmetatable, pairs, ipairs =
module (...) module (...)
local modenv = getfenv() -- module environment local modenv = getfenv() -- module environment
-- private
local function timestamps(T)
local H = {} -- helper table, an indexed array containing all the measurement's timestamps
for timestamp in pairs(T) do H[#H+1] = timestamp end
table.sort(H) -- sort in ascending order, oldest timestamps will be treated first
return H
end
function new() function new()
return setmetatable({}, {__index = modenv}) return setmetatable({}, {__index = modenv})
end end
@ -89,10 +97,3 @@ function json_encode(M)
end end
return J return J
end end
function timestamps(T)
local H = {} -- helper table, an indexed array containing all the measurement's timestamps
for timestamp in pairs(T) do H[#H+1] = timestamp end
table.sort(H) -- sort in ascending order, oldest timestamps will be treated first
return H
end