Re: Reading a conf file
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Reading a conf file
- From: Nicola Fontana <ntd@...>
- Date: 2016年9月28日 08:29:40 +0200
Il 2016年9月27日 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