[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: need help: some features of Lua don't fit well together
- From: Konstantin Osipov <kostja@...>
- Date: Tue, 14 Apr 2015 20:06:15 +0300
* Javier Guerra Giraldez <javier@guerrag.com> [15/04/14 19:16]:
> > Since there is no easy way to distinguish between a Lua map and an
> > array, we have to traverse each argument of conversion, and check that
> > its keys are numeric. If all keys are numeric, keys start with 1,
> > and there are no gaps in keys, it's a list. Otherwise, it's a map and
> > it must be treated the same way as a scalar - become a list field.
>
> in your data model, what is the definition of "map"? the full
> featureset of Lua tables? if so, i think you would have to consider
> arrays as a subset of maps.
>
> if, OTOH, your maps have some more specific definition, you could take
> advantage of it. for example, JSON objects allow only strings as keys
> so simply testing (value[1] ~= nil) is enough to discriminate between
> them
Hello Javier,
This is something that can work indeed!
--
http://tarantool.org - a NoSQL database in a Lua script