I heard that Lua is great for configuration files, so long as you are secure about it. Lua has been used as config files by programs such as awesome
and (recently) conky
.
However, I also heard that using programming to configure a program is an anti-pattern.
Since Lua does not get compiled as part of the program, would this prove as an exception?
Here's a hint of what Lua might look like as a config file:
return {
rootdir = "/abc/123",
debug = true,
things = {
"foo",
"bar",
"baz",
"qux"
}
}
sendmail.cf
, which is accidentally Turing-complete. – Jörg W Mittag Dec 11 '16 at 1:45eval
. The OP is asking about using Lua in the same way. – Nicol Bolas Dec 11 '16 at 15:19return
to return a table. I just define global variables (the config script is given a clean environment, and the environment is tossed away after reading the configs). – user204677 Feb 1 '18 at 6:29