[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua as a configuration language -- validation
- From: Chris Smith <space.dandy@...>
- Date: Fri, 23 Aug 2019 09:37:59 +0100
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>