How can I use utf8.offset(s, n, i) to find the offset of the character at n starting from specific byte and character positions? The i parameter is documented as:
Returns the position (in bytes) where the encoding of the n-th character of s (counting from position i) starts...
I got i is what I need, but I can't understand if it's byte position or character position. How can I use it?
All string offsets in the Lua manual are in bytes, unless the manual specifically says otherwise. So
iis a byte offset, as isutf8.offset's return value.