lua-users home
lua-l archive

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


On Thu, Aug 22, 2019 at 8:25 AM Chris Smith <space.dandy@icloud.com> wrote:
>
> I’m using Lua for configuration.  That means I need to validate entries for correctness, provide default values and warning messages where necessary, as well as ensuring my code doesn’t blow up when trying to access a non-existent structure.  I’m finding my code becoming bloated with largely boiler-plate safety code, particularly when accessing entries that are nested a few levels deep.
>
> Is there a nice, idiomatic way of handling this?
>


I'm not sure how idiomatic this is, but here's something I wrote up a
few years ago:

https://luarocks.org/modules/luarocks/validate-args