From 75dea1156cf1f90115796b3b6a63d5c71e6cd21c Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 14 Sep 2010 23:27:00 +0200 Subject: beta 2010.09.14 23:27 --- scripts/context/lua/mtxrun.lua | 17 +++++++++++++---- scripts/context/stubs/mswin/mtxrun.lua | 17 +++++++++++++---- scripts/context/stubs/unix/mtxrun | 17 +++++++++++++---- 3 files changed, 39 insertions(+), 12 deletions(-) (limited to 'scripts') 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 -- cgit v1.2.3