[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Locale problem
- From: "Tai Meng" <tmeng@...>
- Date: Tue, 13 Jan 2004 18:25:27 -0800
You might want to be careful about the ',' separator. For example,
os.setlocale('Portuguese - Brazil')
num = 5,6 --> num has a value of 5, though 5.6 might have been expected
num = tonumber( "5,6" ) --> num has a value of 5.6
There are other places too like specifying table fields i.e. t = {1,23} vs t = {tonumber( "1,23" )}.
Tai
-----Original Message-----
From: Marcos E. Wurzius [mailto:marcoswur@yahoo.com.br]
Sent: Tuesday, January 13, 2004 8:11 AM
To: Lua list
Subject: Re: Locale problem
marcus.cf wrote:
> 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 '.'
>
On Windows :
os.setlocale('Portuguese - Brazil')
io.read('*n') -- accepts the number 5,6 and not 5.6
os.setlocale('English')
io.read('*n') -- back to '.'
--
Marcos