Hi to all, all word replace scripts don't work with russian, becaue function string.lower don't understand it.. how may fix this problem?
Use a table...
before string.lower the text, do a for loop and gsub the letters.
If you can't figuer it out, i got an example code
There must be something to do with os.setlocale :
Quote from: Lua5.1Manual
os.setlocale (locale [, category])
Sets the current locale of the program. locale is a string specifying a locale; category is an optional string describing which category to change: "all", "collate", "ctype", "monetary", "numeric", or "time"; the default category is "all". The function returns the name of the new locale, or nil if the request cannot be honored.
When called with nil as the first argument, this function only returns the name of the current locale for the given category.
I believe yours may work like:
os.setlocale('ru_RU')
oh man, those hyper-difficult codes make me feel sick :(
Is there any site or module wich contains all the codes of ptokax??
Quote from: speedX on 15 December, 2006, 20:04:47
oh man, those hyper-difficult codes make me feel sick :(
Is there any site or module wich contains all the codes of ptokax??
what codes ?
do you mean 'ru_RU', 'el_GR' ?
check this out :) (http://search.cpan.org/~drolsky/DateTime-Locale-0.32/lib/DateTime/LocaleCatalog.pm)
os.setlocale('ru_RU') - no effect..
Madman, please give me example
Quote from: Light on 16 December, 2006, 21:52:11
os.setlocale('ru_RU') - no effect..
Madman, please give me example
Where did you use it in the script? I suppose you should use it in Main().
function Main()
os.setlocale("ru_RU")
assert(os.setlocale() == "ru_RU", "The locale wasn't set")
end
IIRC you can directly assert os.setlocale("ru_RU"), since it returns nil on failure.
Yes, i use it in main(). it returns nil..
This problem appers in lua 5.1 version, in older versions string functions processing normaly
BadLetters = {
["?"] = "?",
["?"] = "?",
["?"] = "?",
}
function ChatArrival(curUser,data)
local data = string.sub(data,1,-2)
local s,e,text = string.find(data,"%b<>(.+)")
for Upper,Lower in pairs(BadLetters) do
if string.find(text,Upper) then
text = string.gsub(text,Upper,Lower)
end
end
SendToAll(curUser.sName,string.lower(text)) return 1
end
Hopes it helps...