[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Reading a conf file
 
- From: Nicola Fontana <ntd@...>
 
- Date: Wed, 28 Sep 2016 08:29:40 +0200
 
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