summaryrefslogtreecommitdiff
path: root/lualibs-string.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lualibs-string.lua')
-rw-r--r--lualibs-string.lua9
1 files changed, 5 insertions, 4 deletions
diff --git a/lualibs-string.lua b/lualibs-string.lua
index 3b1a000..e9dc2bb 100644
--- a/lualibs-string.lua
+++ b/lualibs-string.lua
@@ -94,7 +94,7 @@ end
-- return not find(str,"%S")
-- end
-local pattern = P(" ")^0 * P(-1)
+local pattern = P(" ")^0 * P(-1) -- maybe also newlines
-- patterns.onlyspaces = pattern
@@ -192,10 +192,11 @@ string.itself = function(s) return s end
-- also handy (see utf variant)
-local pattern = Ct(C(1)^0) -- string and not utf !
+local pattern_c = Ct( C(1) ^0) -- string and not utf !
+local pattern_b = Ct((C(1)/byte)^0)
-function string.totable(str)
- return lpegmatch(pattern,str)
+function string.totable(str,bytes)
+ return lpegmatch(bytes and pattern_b or pattern_c,str)
end
-- handy from within tex: