lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I tried the following and it worked on Linux. It didn't 
work on Windows probably because the C compiler didn't 
support locales the same way Linux did (don't remember 
if it was me who compiled my Windows version of Lua)

os.setlocale('pt_BR', 'numeric')
io.read('*n') -- accepts the number 5,6 and not 5.6

os.setlocale('C', 'numeric')
io.read('*n') -- back to '.'

> Hi, All.
> I have the next problem:
> I use Lua 5.0 and I want my code to not be dependented
> by locale "decimal symbol".
> I decide to use the point as decimal symbol, but if in
> Windows is chosen comma as decimal symbol, Lua show
> error...
> I want to change locale settings in my program at the
> begining and when Lua finish, to restore settings for
> Number:decimal symbols...
> I see that I have to use
> os.setlocale("numeric","..."), but I dont know exactly
> how:-(
> Can you anybody help me?

 
__________________________________________________________________________
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/