.\" Copyright (c) 2018-2022, OARC, Inc. .\" All rights reserved. .\" .\" This file is part of dnsjit. .\" .\" dnsjit is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation, either version 3 of the License, or .\" (at your option) any later version. .\" .\" dnsjit is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with dnsjit. If not, see . .\" .TH dnsjit.lib.parseconf 3 "1.2.3" "dnsjit" .SH NAME dnsjit.lib.parseconf \- Parse simple config files .SH SYNOPSIS local conf = require("dnsjit.lib.parseconf").new() conf:func("config_name", function(k,...) print(k,...) end) conf:file(file) print(conf:val("another_config_name")) .SH DESCRIPTION This module parses simple config files that are based on the config syntax of DSC, drool and parseconf helper library. Each config begins with a .B name followed by .B options and ends with a .BR ; . Multiple configs can be given on the same line. Valid option types are .IR number , .IR float , .IR string , .IR "quoted string" . Comments can be added by prefixing the comment with .BR # . .SS Example # Comment number 12345; float 123.456; string string string; quoted_string "string string string"; multi config; on one line; .SS Functions .TP .BR Parseconf.new "()" Create a new Parseconf object. .TP .BR Parseconf:log "()" Return the Log object to control logging of this instance or module. .TP .BR Parseconf:func "(name, func)" Set a function to call when config .I name is found. .TP .BR Parseconf:file "(fn)" Parse the given file. .TP .BR Parseconf:line "(l)" Parse the given line. .TP .BR Parseconf:val "(name)" Get the value of a config .IR name . .SH AUTHORS and CONTRIBUTORS Jerry Lundström (DNS-OARC), Tomáš Křížek (CZ.NIC), Petr Špaček (ISC) .LP Maintained by DNS-OARC .LP .RS .I https://www.dns-oarc.net/ .RE .LP .SH BUGS For issues and feature requests please use: .LP .RS \fIhttps://github.com/DNS-OARC/dnsjit/issues\fP .RE .LP For question and help please use: .LP .RS \fIadmin@dns-oarc.net\fP .RE .LP