diff options
author | Hans Hagen <pragma@wxs.nl> | 2017-03-02 23:00:09 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2017-03-02 23:00:09 +0100 |
commit | 8f5c555274eb48fcaaa3d7f340ee77710846fb7e (patch) | |
tree | 7e1802669127ba84d78ba62534f34e556b5c6e59 /tex/context/base/mkiv/l-string.lua | |
parent | 6c9a5085dc2cee2c277d69d2dfcb397dab7aeb19 (diff) | |
download | context-8f5c555274eb48fcaaa3d7f340ee77710846fb7e.tar.gz |
2017-03-02 22:28:00
Diffstat (limited to 'tex/context/base/mkiv/l-string.lua')
-rw-r--r-- | tex/context/base/mkiv/l-string.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/l-string.lua b/tex/context/base/mkiv/l-string.lua index be8f397ae..2e8c61196 100644 --- a/tex/context/base/mkiv/l-string.lua +++ b/tex/context/base/mkiv/l-string.lua @@ -212,3 +212,24 @@ end string.quote = string.quoted string.unquote = string.unquoted + +-- new + +if not string.bytetable then + + local limit = 5000 -- we can go to 8000 in luajit and much higher in lua if needed + + function string.bytetable(str) + local n = #str + if n > limit then + local t = { byte(str,1,limit) } + for i=limit+1,n do + t[i] = byte(str,i) + end + return t + else + return { byte(str,1,n) } + end + end + +end |