lua-users home
lua-l archive

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


> There's a standard way to attach metadata to tables, and it's to put them
> in metatables. Add a meta-field for whatever information you need, write
> predicates isarray() / ishash() which abstract implementation details
> away, and you're done.

Hmm, I guess we could do that and allow the user to pass those methods
to the libraries. It is a bit convoluted but LuaJSON does that:
https://github.com/harningt/luajson/blob/master/lua/json/encode/array.lua#L31

Thank you for the suggestion. I hope library authors will follow it now :)

-- 
Pierre Chapuis