lua-users home
lua-l archive

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


Am 16.11.2016 um 13:32 schröbte Xavier Wang:
Hi list,

Hi!


If you have a table have very complex structure, to select
something from it become very difficult.

Any feedback are welcome :-)

There is LPeg for table structures[1], some pattern matching on table structures[2], and if you are having some (a lot of) free time, you can look into lenses, prisms and traversables which is how some functional languages (e.g. Haskell) handle accessing/modifying compound data structures in a declarative way (you can find a very primitive and incomplete implementation in Lua here[3], but there is also some Javascript code out there -- in case you don't like reading Haskell).

Philipp


  [1]: https://github.com/mascarenhas/lpeg-list
  [2]: https://github.com/silentbicycle/tamale
  [3]: https://github.com/siffiejoe/lua-fx/blob/master/tests/ltest.lua