/usr/share/doc/lua-penlight-dev/examples/testconfig.lua is in lua-penlight-dev 1.3.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | local stringio = require 'pl.stringio'
local config = require 'pl.config'
function dump(t,indent)
if type(t) == 'table' then
io.write(indent,'{\n')
local newindent = indent..' '
for k,v in pairs(t) do
io.write(newindent,k,'=')
dump(v,indent)
io.write('\n')
end
io.write(newindent,'},\n')
else
io.write(indent,t,'(',type(t),')')
end
end
function testconfig(test)
local f = stringio.open(test)
local c = config.read(f)
f:close()
dump(c,' ')
print '-----'
end
testconfig [[
; comment 2 (an ini file)
[section!]
bonzo.dog=20,30
config_parm=here we go again
depth = 2
[another]
felix="cat"
]]
testconfig [[
# this is a more Unix-y config file
fred = 1
alice = 2
home = /bonzo/dog/etc
]]
testconfig [[
# this is just a set of comma-separated values
1000,444,222
44,555,224
]]
|