summaryrefslogtreecommitdiff
path: root/examples/simple-config-reader.lua
blob: 823d285e3ebc67c6223497d48c2e7d5622fb7bee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- examples/simple-config-reader.lua
--
-- Simple configuration reader which interrogates only specific keys
--
-- Copyright 2012 Daniel Silverstone <dsilvers@digital-scurf.org>
--

clod = require "clod"

local configuration = [[
project.name "Clod"
project.head "refs/heads/master"
]]

conf, err = clod.parse(configuration)
if not conf then
   error(err)
end

print("Project name is", conf.settings["project.name"])
print("Project HEAD is", conf.settings.project.head)
print("Unknown entry is", conf.settings.project.isnil)