[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Noob's attempt at Lua
- From: "Pierre Chapuis" <lua@...>
- Date: Mon, 25 Apr 2022 11:15:33 +0200
On Sun, Apr 24, 2022, at 23:05, siiky wrote:
>> This might be quite involved, as I counted 45 JSON modules in LuaRocks
>> alone. Just looking at three of them:
>> (...)
>
> Maybe I didn't explain myself well. The exported procedures already
> accept a per-request reader/writer that overrides the default
> reader/writer. I was thinking that maybe it's worth making the /default/
> reader and writer an instance variable as well, instead of using
> lunajson. So I don't see why it would be significantly hard, and why
> the number of different libraries and interfaces matters. Of course the
> user must provide a reader/writer that satisfies a certain interface
> (e.g. the reader has to accept a string as input, and output whatever
> structure they want).
That's a good approach, and one I follow as much as possible.
Regarding the JSON writer, be careful that the interface you define
must be a bit more than naive though, because it probably needs
to support some way to distinguish tables as arrays from tables as
maps.
--
Pierre Chapuis