diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-09-14 23:27:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-09-14 23:27:00 +0200 |
commit | 75dea1156cf1f90115796b3b6a63d5c71e6cd21c (patch) | |
tree | 91c3c77061f9609d7f9ae516d61ec60cff73dd3a /scripts | |
parent | 52df46e2b66699956b360a9126bd65d8f2e5b062 (diff) | |
download | context-75dea1156cf1f90115796b3b6a63d5c71e6cd21c.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 | ||||
-rwxr-xr-x | 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 100755 --- 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 |