[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [NoW] Missing things from Lua
- From: dyngeccetor8 <dyngeccetor8@...>
- Date: Thu, 16 May 2019 12:50:15 +0300
On 16/05/2019 01.25, Sean Conner wrote:
> 2) There is os.setlocale(), but not os.localeconv(). It would not be hard
> to write, and it should return a table formatted (at least) like:
>
> [spc]lucy:/tmp>lua xx.lua se_NO.UTF-8
> locale =
> {
> thousands_sep = ".",
> n_cs_precedes = true,
> frac_digits = 2,000000,
> [...]>
> -spc
The "fun" thing is that Lua tries not to use tables to return
results. Yes, because they will occupy memory till next __gc.
So proposed os.localeconv() will probably return string with
values in fixed order, separated by newline. (String will
occupy memory too but will not have duplicates by design.)
And Lua does not use tables to get arguments too. Probably
because it's uncomfortable to prepare table argument in C.
It again uses strings and list of parameters.
For example, load() accept 4 parameters. Anyone remembers order?
debug.getinfo() get options from string. And I need reference card
to know that "S" there means "include source" and "l" means
"include current line".
At least debug.getinfo() returns result as table, rare exception.
Along with os.date() and os.time().
I wish standard Lua libraries use more Lua tables both for
arguments and results.
-- Martin