lua-users home
lua-l archive

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


Good idea.  How would the Section function look like?


> Marc Balmer wrote:
>> I posted a short article on how to use Lua as a configuration and data exchange language.
>> 
>> Comments welcome.
>> 
>> http://www.netbsd.org/~mbalmer/lua/lua_config.pdf
> 
> It's worth adding an explanation of multiline comments and strings.
> 
> It's also possible to implement something like this:
> 
> Iface "lo0" {
>    ip="127.0.0.1",
>    mask="255.0.0.0"
> }
> 
> and build a framework to register sections and define validation
> rules. For instance:
> 
> local Iface = Section { ip="string", mask="string" }
> 
> The simplest version of Iface is below.
> 
> function Iface(name)
>        return
>                function(content)
>                        _G[name] = content
>                end
> end
> 
> Alex
>