lua-users home
lua-l archive

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


On Tue, 12 Feb 2013 11:26:19 -0700
William Sumner <prestonsumner@me.com> wrote:

> On Feb 12, 2013, at 11:02 AM, Dirk Laurie <dirk.laurie@gmail.com>
> wrote:
> 
> > 2013/2/12 William Sumner <prestonsumner@me.com>:
> > 
> >> Lua's utility as a configuration language makes syntax an end-user
> >> feature.
> > 
> > You don't need to stop at what the Lua standalone handles out of
> > the box. Your own program can be written in Lua and accept
> > configuration information in quite a large selection of formats. A
> > well-known format and a good format are, in that order:
> > 
> > opt1 = json [[
> > ...
> > ]]
> > 
> > opt2 = yaml [[
> > ...
> > ]]
> 
> Despite all that stuff I wrote about syntax, I believe in dealing
> with one language's quirks at a time. :) I prefer using 100% Lua for
> consistency's sake, and for documentation's sake. However, this is a
> great solution if you need those formats.
> 
> I should also say that it wasn't my intent to criticize Lua. Just to
> make the point that I believe it's justified to debate syntax now and
> then since the language is often exposed to end users.
> 
> Preston
> 

Not only that, Preston, but you've also identified different levels of
"User configurability". Using Lua as a configuration language confers
maximal power to the user. Heck, the user could write a callback
routine. But it is also difficult for the user who isn't Lua-proficient
to avoid errors.

YAML (I know nothing of JSON) is much simpler and easier for the user,
and can be used to represent a lot of data structures, but you can't
program behavior with it.

Simplest of all would be a key value pair list. Any user with an IQ
greater than a cabbage can do it, but it offers little more power than
what could be accepted as command line arguments.

Perhaps the trick is deciding which way to go. Or perhaps make a
combination.

SteveT