lua-users home
lua-l archive

Re: Is Lua used as a data representation language?

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


On Sat, Jan 5, 2013 at 3:01 PM, William Ahern
<william@25thandclement.com> wrote:
> Although, autovivification
> is very nice in a configuration language, and Lua can't quite manage it,
> unfortunately.
if i understand correctly, you mean the ability to write:
a.b.c = 5
and getting
a={}
a.b={}
a.b.c=5
or:
a={b={c=5}}
this is sometimes called "automagical tables", or tables on demand,
and there's a simple implementation of this written long ago in the
wiki: http://lua-users.org/wiki/AutomagicTables
and for a XPath-like language, it's not so hard either. Even I wrote
something similar a long time ago (it's almost exactly 5 years ago!):
http://lua.2524044.n2.nabble.com/L4X-td7631898.html It's for XML
processing via loading them in Lua tables (LOM), but similar ideas to
are quite common (and useful).
--
Javier

AltStyle によって変換されたページ (->オリジナル) /