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 |
From: Jacek S. <arn...@gm...> - 2007-12-05 20:32:44
|
> string.subutf8(string, start[,end]) substrings, UTF-8 aware > pos, char = string.nextutf8(string, orig_pos) returns the char at orig_pos and the next char's position in pos. > for i, char in str:nextutf8(orig_pos) iterates through the string, starting at orig_pos. > pos = string.seekutf8(string, orig_pos, n) returns the position orig_pos, N characters forward (or backwards, if N negative). > char = string.utf8char(code) returns the char the code of which is code. > code = string.utf8code(char) returns the code of char (UTF-8 character). > len = string.lenutf8(string) returns the length of string in UTF-8 characters. > > and can be used when one has something exactly to count (for example for checking the length of nicks, counting words and chars of chats) these seem to be of limited use since they treat utf-8 as a special case. > The slnunicode libary is much bigger and adds the table "unicode.utf8" which is similar to the string libary. > When one replaces for example str:match(...) with unicode.utf8.cbb_match(msg, ...) it should do the same as before and works also for utf8. (i did a mistake and renamed match to cbb_match) > I think it should be used for simple hubcommands like +reg nick or for things like bad word filters. Are you the author of the library? Or how did you make a mistake? Did you change the library? > The first libary is maybe optional when one uses slnunicode. Well, it seems easier to maintain just one library instead of two, so if the bigger library contains the functionality of the smaller one, I see no point in adding the small one... /J |
From: <bla...@ar...> - 2007-12-05 21:32:11
|
> > The slnunicode libary is much bigger and adds the table "unicode.utf8" > which is similar to the string libary. > > When one replaces for example str:match(...) with > unicode.utf8.cbb_match(msg, ...) it should do the same as before and work= s > also for utf8. (i did a mistake and renamed match to cbb_match) > > I think it should be used for simple hubcommands like +reg nick or for > things like bad word filters. > Are you the author of the library? Or how did you make a mistake? Did you > change the library? i am not the author but i changed the name of some functions in the libary = because i got "redefined" compiler error in all.c. these functions where already defined= in the string libary of lua. i used replace of an editor and replaced also the name of the lua functions= "match" and "gmatch" in the table "unicode" which is not necessary, that = was the mistake. 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 |
From: Jacek S. <arn...@gm...> - 2007-12-06 21:54:25
|
> i am not the author but i changed the name of some functions in the libary because i got > "redefined" compiler error in all.c. these functions where already defined in the string libary of lua. > i used replace of an editor and replaced also the name of the lua functions "match" and "gmatch" in the table "unicode" which is not necessary, that was the mistake. Well, the correct solution would be to compile it separately from all.c without any modifications to the files...it would require playing some with the sconstruct to get it to build correctly, but the end result will be neater...besides, changing the library would surprise other lua coders if the functions weren't named the same... /J |