[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Reading a conf file
- From: Russell Haley <russ.haley@...>
- Date: Wed, 28 Sep 2016 10:20:57 -0700
Thanks Nicola,
I'll test that asap.
Russ
On Tue, Sep 27, 2016 at 11:29 PM, Nicola Fontana <ntd@entidi.it> wrote:
> Il Tue, 27 Sep 2016 22:41:44 -0700 Russell Haley <russ.haley@gmail.com> scrisse:
>
>> ...
>>
>> local option = line:match("%S+"):lower()
>> local value = line:match("%S*%s*(.*)")
>>
>> if not value then
>> ...
>
> Hi,
>
> I think that substituting above with below should work:
>
> local option, value = line:match('(.-)=(.+)')
>
> if not option then
> elseif not value then
>
> If you want to ignore spaces, put %s* where relevant, e.g.:
>
> line:match('%s*(.-)%s*=%s*(.+)%s*')
>
> Ciao.
> --
> Nicola
>