diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/luat-sta.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/luat-sta.lua | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/luat-sta.lua b/Master/texmf-dist/tex/context/base/luat-sta.lua index 12fa18219bb..a81b0c206fc 100644 --- a/Master/texmf-dist/tex/context/base/luat-sta.lua +++ b/Master/texmf-dist/tex/context/base/luat-sta.lua @@ -7,6 +7,9 @@ if not modules then modules = { } end modules ['luat-sta'] = { -- this code is used in the updater +local gmatch, match = string.gmatch, string.match +local type = type + states = states or { } states.data = states.data or { } states.hash = states.hash or { } @@ -35,13 +38,17 @@ function states.set_by_tag(tag,key,value,default,persistent) if d then if type(d) == "table" then local dkey, hkey = key, key - local pre, post = key:match("(.+)%.([^%.]+)$") + local pre, post = match(key,"(.+)%.([^%.]+)$") if pre and post then - for k in pre:gmatch("[^%.]+") do + for k in gmatch(pre,"[^%.]+") do local dk = d[k] if not dk then dk = { } d[k] = dk + elseif type(dk) == "string" then + -- invalid table, unable to upgrade structure + -- hope for the best or delete the state file + break end d = dk end @@ -69,7 +76,7 @@ function states.get_by_tag(tag,key,default) else local d = states.data[tag] if d then - for k in key:gmatch("[^%.]+") do + for k in gmatch(key,"[^%.]+") do local dk = d[k] if dk then d = dk |