[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Local Variables
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 11 Aug 2014 16:18:16 +0200
2014-08-11 14:37 GMT+02:00 Axel Kittenberger <axkibe@gmail.com>:
> if you have a project that has config files that are supposed to be "Lua"
I've played with your idea of functions with table-valued arguments,
to make a sort of DSL, but even that is asking too much from a user.
I now do it this way:
~~~~
local loadfile = loadfile
local params = {}
do
local ok, msg = loadfile("config.lua","t",params)
if ok then ok, msg = pcall(ok) end
-- check `params` and extract what you can use
end
~~~~
Thus "config.lua" is just like an interactive environment
except that the user has no libraries whatsoever. It typically
looks like this:
year = 2014
host = "SAF"
paper = "A1,C3,G5; G1,N3,C5"
- References:
- Local Variables, Mason Mackaman
- Re: Local Variables, Roberto Ierusalimschy
- Re: Local Variables, Steven Degutis
- Re: Local Variables, Axel Kittenberger
- Re: Local Variables, Tim Hill
- Re: Local Variables, Dirk Laurie
- Re: Local Variables, Dirk Laurie
- Re: Local Variables, Coroutines
- Re: Local Variables, Sean Conner
- Re: Local Variables, Dirk Laurie
- Re: Local Variables, Axel Kittenberger
- Re: Local Variables, Dirk Laurie
- Re: Local Variables, Axel Kittenberger