Unicode
Documentation of the Unicode library.
The Unicode library contains methods that exist in vanilla OpenComputers, but adds some other methods that are exclusive to Halyde.
unicode.readCodePoint(readByte: function): number or nilReads the code point of the first Unicode character from an iterator function that returns a byte when called.unicode.readChar(readByte: function): stringReads the first Unicode character from an iterator function that returns a byte when called.unicode.codepoint(chr: string): numberActs as the reverse function forunicode.char. It returns the codepoint of the character in the string.unicode.iterate(readByte: function): functionTakes an iterator function that returns a byte when called, and returns an iterator function that returns a string when called. The string the output iterator function returns is an Unicode character that is getting read.
For the other, vanilla methods, these have been left untouched:
unicode.char(value: number, ...): stringUTF-8 aware version ofstring.char. The values may be in the full UTF-8 range, not just ASCII.unicode.charWidth(value: string, ...): numberReturns the width of the first character given. For example, forシit'll return2, whereawould return1.unicode.isWide(value: string, ...): booleanReturns if the width of the first character given is greater than 1. For example, forシit'll returntrue, whereawould returnfalse.unicode.len(value: string): numberUTF-8 aware version ofstring.len. For example, forÜmläütit'll return6, wherestring.lenwould return9.unicode.lower(value: string): stringUTF-8 aware version ofstring.lower.unicode.reverse(value: string): stringUTF-8 aware version ofstring.reverse. For example, forÜmläütit'll returntüälmÜ, wherestring.reversewould returntälm.unicode.sub(value: string, i:number[, j:number]): stringUTF-8 aware version ofstring.sub.unicode.upper(value: string): stringUTF-8 aware version ofstring.upper.unicode.wlen(value: string): numberReturns the width of the entire string.unicode.wtrunc(value: string, count: number): stringTruncates the given string up to but not includingcountwidth. If there are not enough characters to match the wanted width, the function errors.
Last updated