lua-users home
lua-l archive

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


First, thanks for support!:-)
Second I still have problems with locals:-(
In code, I call os.setlocale("C", "numeric") in first
line, because I use data with decimal point, but I get
error message: "Syntax error during pre-compilation.:
[string "Run_Code"]:144: malformed number near `0.05'"
How can I avoid this?

--- David Jones <drj@pobox.com> wrote:
> 
> On Jan 15, 2004, at 19:00, Stoil Todorov wrote:
> 
> > Thank You, guys
> > But I don't want to change all local settings:-(
> > I want to change only digital sign - I want to be
> sure
> >  that digital sign will be point during executing
> Lua
> > code...
> > Is it possible?
> 
> I think so:
> 
> os.setlocale("C", "numeric")
> 
> or you can do it from C:
> 
> setlocale(LC_NUMERIC, "C")
> 
> Technically this also changes some other aspects of
> number formatting, 
> such as the thousands grouping character.  See the
> reference for the C 
> function localeconv.  Standard C does not use the
> other aspects of 
> number formatting, but your host application or the
> operating system 
> might.
> 
> Note that os.setlocale can be used to retrieve the
> current locale 
> settings as well.  So if you want to switch between
> the current locale 
> and C do something like this:
> 
> numeric_locale = os.setlocale(nil, 'numeric')
> 
> os.setlocale('pl_PL', 'numeric')
> 
> -- do stuff using comma as the decimal point (at
> least on Mac OS X 
> 10.3).
> 
> -- restore the old locale setting
> 
> os.setlocale(numeric_locale, 'numeric')
> 
> I have to say that this feature is not well
> documented, but obvious 
> enough if you know the C side of things.
> 
> David Jones
> 


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html