summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aconf/model/set.lua4
-rw-r--r--aconf/util.lua7
-rw-r--r--server.lua5
3 files changed, 8 insertions, 8 deletions
diff --git a/aconf/model/set.lua b/aconf/model/set.lua
index 8b51f12..897e1bf 100644
--- a/aconf/model/set.lua
+++ b/aconf/model/set.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012-2014 Kaarle Ritvanen
+Copyright (c) 2012-2015 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -35,7 +35,7 @@ function M.Set:init(context, params)
local mt = getmetatable(self)
function mt.get(k, options)
- options = util.setdefaults(options or {}, {dereference=true})
+ options = util.setdefaults(options, {dereference=true})
local i, v = find(k)
if i then return mt.load(i, options) end
if options.create then return v end
diff --git a/aconf/util.lua b/aconf/util.lua
index d5d5d42..373fc29 100644
--- a/aconf/util.lua
+++ b/aconf/util.lua
@@ -3,7 +3,7 @@
-- @module aconf.util
--[[
-Copyright (c) 2012-2014 Kaarle Ritvanen
+Copyright (c) 2012-2015 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -22,13 +22,14 @@ end
--- merge a table into another.
-- Copy values for all keys from `src` to `dst` and optionally keep existing
--- values.
+-- values. A new table is created if `dst` is nil.
-- @param dst the destination table
-- @param src the source table
-- @param preserve a boolean. If true then will existing entries in `dst` be
-- kept.
-- @return the destination table, `dst`
function M.update(dst, src, preserve)
+ if not dst then dst = {} end
for k, v in pairs(src) do
if not preserve or dst[k] == nil then dst[k] = v end
end
@@ -37,7 +38,7 @@ end
--- copy default vaules from one table to another.
-- Copy all entries in `src` to `dst` but keep any already existing values
--- in `dst`.
+-- in `dst`. A new table is created if `dst` is nil.
-- @param dst the destination table
-- @param src the source table containing the default values
-- @return the destination table, `dst`
diff --git a/server.lua b/server.lua
index 0d28200..c80c766 100644
--- a/server.lua
+++ b/server.lua
@@ -1,5 +1,5 @@
--[[
-Copyright (c) 2012-2014 Kaarle Ritvanen
+Copyright (c) 2012-2015 Kaarle Ritvanen
See LICENSE file for license details
--]]
@@ -24,8 +24,7 @@ local sessions = {}
return function(env)
local function wrap(code, headers, res, encode)
- if not headers then headers = {} end
- update(
+ headers = update(
headers,
{
['Cache-Control']='no-cache, no-store, must-revalidate',