From: <bla...@ar...> - 2007-12-04 23:41:26
|
The first libary is smaller and extends the standard string libary with: string.subutf8(string, start[,end]) substrings, UTF-8 aware=20 pos, char =3D string.nextutf8(string, orig_pos) returns the char at orig_po= s and the next char's position in pos.=20 for i, char in str:nextutf8(orig_pos) iterates through the string, starting= at orig_pos.=20 pos =3D string.seekutf8(string, orig_pos, n) returns the position orig_pos,= N characters forward (or backwards, if N negative).=20 char =3D string.utf8char(code) returns the char the code of which is code.= =20 code =3D string.utf8code(char) returns the code of char (UTF-8 character).= =20 len =3D string.lenutf8(string) returns the length of string in UTF-8 charac= ters. and can be used when one has something exactly to count (for example for ch= ecking the length of nicks, counting words and chars of chats) The slnunicode libary is much bigger and adds the table "unicode.utf8" whic= h is similar to the string libary. When one replaces for example str:match(...) with unicode.utf8.cbb_match(ms= g, ...) it should do the same as before and works also for utf8. (i did a m= istake and renamed match to cbb_match) I think it should be used for simple hubcommands like +reg nick or for thin= gs like bad word filters. The first libary is maybe optional when one uses slnunicode. > Why two libraries? when / how are these used? >=20 > /J >=20 > bla...@ar... wrote: > > Hi=20 > >=20 > > this patch adds 2 unicode libaries to lua. The libaries can be found > here: > >=20 > > http://luaforge.net/projects/sln/ > > http://lua-users.org/wiki/ValidateUnicodeString > >=20 > > I added the hubcommand "+slnunicode" to access.lua which executes the t= est > script of slnunicode. > >=20 >=20 Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT F=DCR ALLE NEUEINSTEIGER Jetzt bei Arcor: g=FCnstig und schnell mit DSL - das All-Inclusive-Paket f=FCr clevere Doppel-Sparer, nur 29,95 =80 inkl. DSL- und ISDN-Grundgeb= =FChr! http://www.arcor.de/rd/emf-dsl-2 |