lua-users home
lua-l archive

Re: Lua as a configuration language -- validation

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


Thank you for all the responses. I think for my current purpose I’m going to go with a simple pcall wrapper. Something like this:
local value, error = config(function() return config.UI.mainwindow.size.width end, ’number’, 100)
Or this:
local value, error = config(‘config.UI.mainwindow.size.width’, ’number’, 100)
The second would need a load() before pcall(), but makes it much easier to construct an error message.
Regards,
Chris
—
Chris Smith <space.dandy@icloud.com>

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