Garry's Mod Wiki

utf8.codepoint

  vararg utf8.codepoint( string string, number startPos = 1, number endPos = 1 )

Description

Returns the codepoints (as numbers) from all characters in the given string that start between byte position startPos and endPos. It raises an error if it meets any invalid byte sequence. This functions similarly to string.byte.

Arguments

1 string string
The string that you will get the code(s) from.
2 number startPos = 1
The starting byte of the string to get the codepoint of.
3 number endPos = 1
The ending byte of the string to get the codepoint of.

Returns

1 vararg
The codepoint number(s).

Example

Demonstrates usage of the function.

print( utf8.codepoint( "Мёнём", 1, -1 ) )
Output: 1052 1105 1085 1105 1084