[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:23:08 -0700
On Wed, Sep 28, 2016 at 9:44 AM, Jerome Vuarand
<jerome.vuarand@gmail.com> wrote:
> 2016-09-28 6:51 GMT+01:00 Sean Conner <sean@conman.org>:
>> You already have a parser available to you---Lua. If the config file is
>> just what you said:
>>
>> a=series
>> of=key
>> value=pairs
>>
>> A small change:
>
> You don't need to change the syntax to use the Lua parser for that.
> With a metatable on the _ENV, you can have global variable reads
> (__index) return the variable name, so that series is the same as
> "series". This only works with valid Lua variable names, but that
> covers a lot of ground and you can fall back to quotes for the rest.
Metatables are on my "I promise to learn that 'soon'" list... lol
Russ