Function
utfSeek
Returns the byte position in a text moved by the given number of characters from a start position - useful when mixing UTF functions with string.find.
Syntax
int utfSeek(string theString, int position [, int offset = 0])Arguments
theStringstring- The text.
positionint- Start byte position (from 1).
offsetint, optional = 0- How many characters to move.Not in MTA:SA
Differences from MTA:SA
- Arguments in a different colour differ from MTA:SA.
In MTA:SA
utfSeek(string theString, int position)Returns
Byte position, or false.
Example
local text = "żółta łódź"
local bytePos = utfSeek(text, 1, 6)
outputServerLog(text:sub(bytePos))