From 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 30 Oct 2021 11:32:16 +0800 Subject: + Penlight --- .../Penlight/docs/libraries/pl.config.html | 259 +++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 Data/Libraries/Penlight/docs/libraries/pl.config.html (limited to 'Data/Libraries/Penlight/docs/libraries/pl.config.html') diff --git a/Data/Libraries/Penlight/docs/libraries/pl.config.html b/Data/Libraries/Penlight/docs/libraries/pl.config.html new file mode 100644 index 0000000..1ad8833 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.config.html @@ -0,0 +1,259 @@ + + + + + Penlight Documentation + + + + +
+ +
+ +
+
+
+ + +
+ + + + + + +
+ +

Module pl.config

+

Reads configuration files into a Lua table.

+

+ +

Understands INI files, classic Unix config files, and simple + delimited columns of values. See the Guide

+ + +
+# test.config
+# Read timeout in seconds
+read.timeout=10
+# Write timeout in seconds
+write.timeout=5
+#acceptable ports
+ports = 1002,1003,1004
+
+-- readconfig.lua
+local config = require 'config'
+local t = config.read 'test.config'
+print(pretty.write(t))
+
+### output #####
+{
+  ports = {
+    1002,
+    1003,
+    1004
+  },
+  write_timeout = 5,
+  read_timeout = 10
+}
+
+ +

+ + +

Functions

+ + + + + + + + + +
lines (file)like io.lines(), but allows for lines to be continued with ''.
read (file[, cnfg])read a configuration file into a table
+ +
+
+ + +

Functions

+ +
+
+ + lines (file) +
+
+ like io.lines(), but allows for lines to be continued with ''. + + +

Parameters:

+
    +
  • file + a file-like object (anything where read() returns the next line) or a filename. + Defaults to stardard input. +
  • +
+ +

Returns:

+
    +
  1. + an iterator over the lines, or nil
  2. +
  3. + error 'not a file-like object' or 'file is nil'
  4. +
+ + + + +
+
+ + read (file[, cnfg]) +
+
+ read a configuration file into a table + + +

Parameters:

+
    +
  • file + either a file-like object or a string, which must be a filename +
  • +
  • cnfg + tab + +

    a configuration table that may contain these fields:

    + +
      +
    • smart try to deduce what kind of config file we have (default false)
    • +
    • variabilize make names into valid Lua identifiers (default true)
    • +
    • convert_numbers try to convert values into numbers (default true)
    • +
    • trim_space ensure that there is no starting or trailing whitespace with values (default true)
    • +
    • trim_quotes remove quotes from strings (default false)
    • +
    • list_delim delimiter to use when separating columns (default ',')
    • +
    • keysep separator between key and value pairs (default '=')
    • +
    + + + (optional) +
  • +
+ +

Returns:

+
    +
  1. + a table containing items, or nil
  2. +
  3. + error message (same as config.lines
  4. +
+ + + + +
+
+ + +
+
+
+generated by LDoc 1.4.6 +
+
+ + -- cgit v1.1-26-g67d0