[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: string.bytes
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 12 Apr 2019 11:01:46 +0200
By analogy to the function utf8.codes, it would be nice to have a
function string.bytes so that the construction
for p, c in string.bytes(s) do body end
will iterate over all bytes in string s, with p being the position.
This is surprisingly clumsy in pure Lua, unless I am missing a trick.
Of course, if the string is pure ASCII, utf8.codes will do the trick.