diff options
author | Marius <mariausol@gmail.com> | 2010-09-15 09:21:49 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-09-15 09:21:49 +0300 |
commit | 3baed6092e175a237fb3f11144b5abf990c80759 (patch) | |
tree | 704ba449a1cce3d75514d9431bf64322601adea1 /scripts | |
parent | 37b0c79d3951304959d24218874992d125bf9854 (diff) | |
download | context-3baed6092e175a237fb3f11144b5abf990c80759.tar.gz |
beta 2010.09.14 23:27
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 17 | ||||
-rw-r--r-- | scripts/context/stubs/mswin/mtxrun.lua | 17 | ||||
-rw-r--r-- | scripts/context/stubs/unix/mtxrun | 17 |
3 files changed, 39 insertions, 12 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index 216a8080f..b175a35a4 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -4281,6 +4281,9 @@ local function set(t,what,newvalue) if type(what) == "string" then what = settings_to_hash(what) -- inefficient but ok end + if type(what) ~= "table" then + return + end for w, value in next, what do if value == "" then value = newvalue @@ -12515,8 +12518,10 @@ local function set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -12539,13 +12544,17 @@ local function get_by_tag(tag,key,default) if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua index 216a8080f..b175a35a4 100644 --- a/scripts/context/stubs/mswin/mtxrun.lua +++ b/scripts/context/stubs/mswin/mtxrun.lua @@ -4281,6 +4281,9 @@ local function set(t,what,newvalue) if type(what) == "string" then what = settings_to_hash(what) -- inefficient but ok end + if type(what) ~= "table" then + return + end for w, value in next, what do if value == "" then value = newvalue @@ -12515,8 +12518,10 @@ local function set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -12539,13 +12544,17 @@ local function get_by_tag(tag,key,default) if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun index 216a8080f..b175a35a4 100644 --- a/scripts/context/stubs/unix/mtxrun +++ b/scripts/context/stubs/unix/mtxrun @@ -4281,6 +4281,9 @@ local function set(t,what,newvalue) if type(what) == "string" then what = settings_to_hash(what) -- inefficient but ok end + if type(what) ~= "table" then + return + end for w, value in next, what do if value == "" then value = newvalue @@ -12515,8 +12518,10 @@ local function set_by_tag(tag,key,value,default,persistent) end dkey, hkey = post, key end - if type(value) == nil then - value = value or default + if value == nil then + value = default + elseif value == false then + -- special case elseif persistent then value = value or d[dkey] or default else @@ -12539,13 +12544,17 @@ local function get_by_tag(tag,key,default) if d then for k in gmatch(key,"[^%.]+") do local dk = d[k] - if dk then + if dk ~= nil then d = dk else return default end end - return d or default + if d == false then + return false + else + return d or default + end end end end |