Lore archive · Warcraft Wiki, 2023 dump
API strbyte
Last wiki revision 2022-07-22
Returns the numerical code of a character in a string. indexByte = string.byte(s [, index[, endIndex]]) indexByte = strbyte(s [, index[, endIndex]])
- s [, index[, endIndex]]
- s: - The string to get the numerical code from
- index: - Optional argument specifying the index of the character to get the byte value of
- endIndex: - Optional argument specifying the index of the last character to return the value of
- indexByte: - The byte value of the character at the specified position or nil if the index is invalid
> = string.byte("ABCDE") -- no index, so the first character 65 > = string.byte("ABCDE",1) -- indexes start at 1 65 > = string.byte("ABCDE",0) -- we're not using C > = string.byte("ABCDE",100) -- index out of range, no value returned > = string.byte("ABCDE", 1, 3) 65 66 67
- The first valid index is 1.
- The last valid index is the length of the string.
Source
https://warcraft.wiki.gg/wiki/API_strbyte · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.