lua-users home
lua-l archive

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


Great, thank you. That also should able to ease the internationalization by making direct locale numbers some syntactic sugar for their quoted counterpart. Does this functionality also take into account things like Indian and Eastern Arabic numerals?


Le 29/11/2016 à 12:45, Luiz Henrique de Figueiredo a écrit :
You need to set the locale inside Lua:

	% lua
	Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
	> os.setlocale"fr_FR"
	fr_FR
	> "3,14" + 1
	4,14
os.setlocale("") is a better solution because it reads the locale from
the environment:

	env LC_NUMERIC="fr_FR.UTF-8" lua
	Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
	> os.setlocale("")
	en_US.ISO8859-1/en_US.ISO8859-1/en_US.ISO8859-1/fr_FR.UTF-8/en_US.ISO8859-1/en_US.ISO8859-1
	> "3,14" + 1
	4,14