lua-users home
lua-l archive

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


It was thus said that the Great Philippe Lhoste once stated:
> 
> I believe the historical reason for this choice goes back when Lua was used 
> as data metalanguage: it allows to use locale names as keys for tables:
> 
> a = { Roméo = "Juliette", César = "Brutus" }
> 
> Although I cannot test that because it seems that on Windows it defaults to 
> C locale and refuses to change (unless I am doing something wrong).
> I tried with Web Lua but it doesn't expose os table (I can understand 
> why...).
> Ah, I can do that in Lua.org live demo but I still can't change the locale.
> Perhaps I am doing something wrong?

  I can't do it, and my locale is currently set for "en_US.UTF-8".  I then
tried the following:

> os.setlocale("es.UTF-8")
>  a = { Roméo = "Juliette", César = "Brutus" }
stdin:1: '}' expected near '�
> os.setlocale("es")
>  a = { Roméo = "Juliette", César = "Brutus" }
stdin:1: '}' expected near '�
> os.setlocale("br")
>  a = { Roméo = "Juliette", César = "Brutus" }
stdin:1: '}' expected near '�

  I too, would like to know what I'm doing wrong ... 

  -spc (looks like glibc isn't picking up on the locale properly?)