diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua index fd9351a28fb..76b5fd20bb3 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-dim.lua @@ -397,18 +397,22 @@ function dimen(a) end function string.todimen(str) -- maybe use tex.sp when available - if type(str) == "number" then + local t = type(str) + if t == "number" then return str else local k = known[str] if not k then - local value, unit = lpegmatch(dimenpair,str) - if value and unit then - k = value/unit -- to be considered: round + if t == "string" then + local value, unit = lpegmatch(dimenpair,str) + if value and unit then + k = value/unit -- to be considered: round + else + k = 0 + end else k = 0 end - -- print(str,value,unit) known[str] = k end return k |