lua-users home
lua-l archive

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


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