diff options
author | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-30 11:32:16 +0800 |
commit | 42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce (patch) | |
tree | 24bc7009457a8d7500f264e89946dc20d069294f /Data/Libraries/Penlight/docs/libraries | |
parent | 164885fd98d48703bd771f802d79557b7db97431 (diff) |
+ Penlight
Diffstat (limited to 'Data/Libraries/Penlight/docs/libraries')
34 files changed, 19025 insertions, 0 deletions
diff --git a/Data/Libraries/Penlight/docs/libraries/pl.Set.html b/Data/Libraries/Penlight/docs/libraries/pl.Set.html new file mode 100644 index 0000000..8eda41e --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.Set.html @@ -0,0 +1,650 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="../index.html">Index</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#metamethods">metamethods</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><strong>pl.Set</strong></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testapp.lua.html">testapp.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.Set</code></h1> +<p>A Set class.</p> +<p> + +<pre> +> Set = <span class="global">require</span> <span class="string">'pl.Set'</span> +> = Set{<span class="string">'one'</span>,<span class="string">'two'</span>} == Set{<span class="string">'two'</span>,<span class="string">'one'</span>} +<span class="keyword">true</span> +> fruit = Set{<span class="string">'apple'</span>,<span class="string">'banana'</span>,<span class="string">'orange'</span>} +> = fruit[<span class="string">'banana'</span>] +<span class="keyword">true</span> +> = fruit[<span class="string">'hazelnut'</span>] +<span class="keyword">nil</span> +> colours = Set{<span class="string">'red'</span>,<span class="string">'orange'</span>,<span class="string">'green'</span>,<span class="string">'blue'</span>} +> = fruit,colours +[apple,orange,banana] [blue,green,orange,red] +> = fruit+colours +[blue,green,apple,red,orange,banana] +[orange] +> more_fruits = fruit + <span class="string">'apricot'</span> +> = fruit*colours + = more_fruits, fruit +banana,apricot,apple,orange] [banana,apple,orange] +</pre> + + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.tablex.html#">pl.tablex</a>, <a href="../libraries/pl.class.html#">pl.class</a>, <a href="../classes/pl.Map.html#">pl.Map</a>, (<a href="../classes/pl.List.html#">pl.List</a> if __tostring is used)</p></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#Set">Set (t)</a></td> + <td class="summary">create a set.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#values">values (self)</a></td> + <td class="summary">get a list of the values in a set.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map">map (self, fn, ...)</a></td> + <td class="summary">map a function over the values of a set.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#union">union (self, set)</a></td> + <td class="summary">union of two sets (also +).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#intersection">intersection (self, set)</a></td> + <td class="summary">intersection of two sets (also *).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#difference">difference (self, set)</a></td> + <td class="summary">new set with elements in the set that are not in the other (also -).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#issubset">issubset (self, set)</a></td> + <td class="summary">is the first set a subset of the second (also <)?.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isempty">isempty (self)</a></td> + <td class="summary">is the set empty?.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isdisjoint">isdisjoint (s1, s2)</a></td> + <td class="summary">are the sets disjoint?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#len">len (s)</a></td> + <td class="summary">size of this set (also # for 5.2).</td> + </tr> +</table> +<h2><a href="#metamethods">metamethods</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#__tostring">__tostring ()</a></td> + <td class="summary">string representation of a set.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__add">__add ()</a></td> + <td class="summary">union of sets.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__mul">__mul ()</a></td> + <td class="summary">intersection of sets.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__sub">__sub ()</a></td> + <td class="summary">difference of sets.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__pow">__pow ()</a></td> + <td class="summary">symmetric difference of sets.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__lt">__lt ()</a></td> + <td class="summary">first set subset of second?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__len">__len ()</a></td> + <td class="summary">cardinality of set (5.2).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#__eq">__eq (s1, s2)</a></td> + <td class="summary">equality between sets.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "Set"></a> + <strong>Set (t)</strong> + </dt> + <dd> + create a set. <br> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + may be a Set, Map or list-like table. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "values"></a> + <strong>values (self)</strong> + </dt> + <dd> + get a list of the values in a set. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list + </ol> + + + + +</dd> + <dt> + <a name = "map"></a> + <strong>map (self, fn, ...)</strong> + </dt> + <dd> + map a function over the values of a set. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + <li><span class="parameter">fn</span> + a function + </li> + <li><span class="parameter">...</span> + extra arguments to pass to the function. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new set + </ol> + + + + +</dd> + <dt> + <a name = "union"></a> + <strong>union (self, set)</strong> + </dt> + <dd> + union of two sets (also +). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + <li><span class="parameter">set</span> + another set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new set + </ol> + + + + +</dd> + <dt> + <a name = "intersection"></a> + <strong>intersection (self, set)</strong> + </dt> + <dd> + intersection of two sets (also *). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + <li><span class="parameter">set</span> + another set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new set + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">> s = Set{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>} +> t = Set{<span class="number">20</span>,<span class="number">30</span>,<span class="number">40</span>} +> = t +[<span class="number">20</span>,<span class="number">30</span>,<span class="number">40</span>] +> = Set.intersection(s,t) +[<span class="number">30</span>,<span class="number">20</span>] +> = s*t +[<span class="number">30</span>,<span class="number">20</span>]</pre> + </ul> + +</dd> + <dt> + <a name = "difference"></a> + <strong>difference (self, set)</strong> + </dt> + <dd> + new set with elements in the set that are not in the other (also -). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + <li><span class="parameter">set</span> + another set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new set + </ol> + + + + +</dd> + <dt> + <a name = "issubset"></a> + <strong>issubset (self, set)</strong> + </dt> + <dd> + is the first set a subset of the second (also <)?. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + <li><span class="parameter">set</span> + another set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "isempty"></a> + <strong>isempty (self)</strong> + </dt> + <dd> + is the set empty?. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">self</span> + a Set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "isdisjoint"></a> + <strong>isdisjoint (s1, s2)</strong> + </dt> + <dd> + are the sets disjoint? (no elements in common). + Uses naive definition, i.e. that intersection is empty + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s1</span> + a Set + </li> + <li><span class="parameter">s2</span> + another set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "len"></a> + <strong>len (s)</strong> + </dt> + <dd> + size of this set (also # for 5.2). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + a Set + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + size + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="metamethods"></a>metamethods</h2> + + <dl class="function"> + <dt> + <a name = "__tostring"></a> + <strong>__tostring ()</strong> + </dt> + <dd> + string representation of a set. + + + + + + + +</dd> + <dt> + <a name = "__add"></a> + <strong>__add ()</strong> + </dt> + <dd> + union of sets. + + + + + + + +</dd> + <dt> + <a name = "__mul"></a> + <strong>__mul ()</strong> + </dt> + <dd> + intersection of sets. + + + + + + + +</dd> + <dt> + <a name = "__sub"></a> + <strong>__sub ()</strong> + </dt> + <dd> + difference of sets. + + + + + + + +</dd> + <dt> + <a name = "__pow"></a> + <strong>__pow ()</strong> + </dt> + <dd> + symmetric difference of sets. + + + + + + + +</dd> + <dt> + <a name = "__lt"></a> + <strong>__lt ()</strong> + </dt> + <dd> + first set subset of second? + + + + + + + +</dd> + <dt> + <a name = "__len"></a> + <strong>__len ()</strong> + </dt> + <dd> + cardinality of set (5.2). + + + + + + + +</dd> + <dt> + <a name = "__eq"></a> + <strong>__eq (s1, s2)</strong> + </dt> + <dd> + equality between sets. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s1</span> + + </li> + <li><span class="parameter">s2</span> + + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +<i style="float:right;">Last updated 2018-11-23 21:07:42 </i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.app.html b/Data/Libraries/Penlight/docs/libraries/pl.app.html new file mode 100644 index 0000000..4417e8f --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.app.html @@ -0,0 +1,397 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><strong>pl.app</strong></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.app</code></h1> +<p>Application support functions.</p> +<p> See <a href="../manual/01-introduction.md.html#Application_Support">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.path.html#">pl.path</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#script_name">script_name ()</a></td> + <td class="summary">return the name of the current script running.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#require_here">require_here (base)</a></td> + <td class="summary">prefixes the current script's path to the Lua module path.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#appfile">appfile (file)</a></td> + <td class="summary">return a suitable path for files private to this application.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#platform">platform ()</a></td> + <td class="summary">return string indicating operating system.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#lua">lua ()</a></td> + <td class="summary">return the full command-line used to invoke this script.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#parse_args">parse_args (args, flags_with_values, flags_valid)</a></td> + <td class="summary">parse command-line arguments into flags and parameters.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "script_name"></a> + <strong>script_name ()</strong> + </dt> + <dd> + return the name of the current script running. + The name will be the name as passed on the command line + + + + <h3>Returns:</h3> + <ol> + + string filename + </ol> + + + + +</dd> + <dt> + <a name = "require_here"></a> + <strong>require_here (base)</strong> + </dt> + <dd> + prefixes the current script's path to the Lua module path. + Applies to both the source and the binary module paths. It makes it easy for + the main file of a multi-file program to access its modules in the same directory. + <code>base</code> allows these modules to be put in a specified subdirectory, to allow for + cleaner deployment and resolve potential conflicts between a script name and its + library directory.</p> + +<p> Note: the path is prefixed, so it is searched first when requiring modules. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">base</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + optional base directory (absolute, or relative path). + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the current script's path with a trailing slash + </ol> + + + + +</dd> + <dt> + <a name = "appfile"></a> + <strong>appfile (file)</strong> + </dt> + <dd> + return a suitable path for files private to this application. + These will look like '~/.SNAME/file', with '~' as with expanduser and + SNAME is the name of the script without .lua extension. + If the directory does not exist, it will be created. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a filename (w/out path) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a full pathname, or nil</li> + <li> + cannot create directory error</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- when run from a script called 'testapp' (on Windows): +</span><span class="keyword">local</span> app = <span class="global">require</span> <span class="string">'pl.app'</span> +<span class="global">print</span>(app.appfile <span class="string">'test.txt'</span>) +<span class="comment">-- C:\Documents and Settings\steve\.testapp\test.txt</span></pre> + </ul> + +</dd> + <dt> + <a name = "platform"></a> + <strong>platform ()</strong> + </dt> + <dd> + return string indicating operating system. + + + + <h3>Returns:</h3> + <ol> + + 'Windows','OSX' or whatever uname returns (e.g. 'Linux') + </ol> + + + + +</dd> + <dt> + <a name = "lua"></a> + <strong>lua ()</strong> + </dt> + <dd> + return the full command-line used to invoke this script. + It will not include the scriptname itself, see <a href="../libraries/pl.app.html#script_name">app.script_name</a>. + + + + <h3>Returns:</h3> + <ol> + <li> + command-line</li> + <li> + name of Lua program used</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- execute: lua -lluacov -e 'print(_VERSION)' myscript.lua +</span> +<span class="comment">-- myscript.lua +</span><span class="global">print</span>(<span class="global">require</span>(<span class="string">"pl.app"</span>).lua()) <span class="comment">--> "lua -lluacov -e 'print(_VERSION)'", "lua"</span></pre> + </ul> + +</dd> + <dt> + <a name = "parse_args"></a> + <strong>parse_args (args, flags_with_values, flags_valid)</strong> + </dt> + <dd> + parse command-line arguments into flags and parameters. + Understands GNU-style command-line flags; short (<code>-f</code>) and long (<code>--flag</code>).</p> + +<p> These may be given a value with either '=' or ':' (<code>-k:2</code>,<code>--alpha=3.2</code>,<code>-n2</code>), + a number value can be given without a space. If the flag is marked + as having a value, then a space-separated value is also accepted (<code>-i hello</code>), + see the <code>flags_with_values</code> argument).</p> + +<p> Multiple short args can be combined like so: ( <code>-abcd</code>).</p> + +<p> When specifying the <code>flags_valid</code> parameter, its contents can also contain + aliasses, to convert short/long flags to the same output name. See the + example below.</p> + +<p> Note: if a flag is repeated, the last value wins. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">args</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + an array of strings (default is the global <code>arg</code>) + </li> + <li><span class="parameter">flags_with_values</span> + <span class="types"><span class="type">tab</span></span> + any flags that take values, either list or hash + table e.g. <code>{ out=true }</code> or <code>{ "out" }</code>. + </li> + <li><span class="parameter">flags_valid</span> + <span class="types"><span class="type">tab</span></span> + (optional) flags that are valid, either list or hashtable. + If not given, everything + will be accepted(everything in <code>flags_with_values</code> will automatically be allowed) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a table of flags (flag=value pairs)</li> + <li> + an array of parameters</li> + </ol> + + <h3>Raises:</h3> + if args is nil, then the global <code>args</code> must be available! + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- Simple form: +</span><span class="keyword">local</span> flags, params = app.parse_args(<span class="keyword">nil</span>, + { <span class="string">"hello"</span>, <span class="string">"world"</span> }, <span class="comment">-- list of flags taking values +</span> { <span class="string">"l"</span>, <span class="string">"a"</span>, <span class="string">"b"</span>}) <span class="comment">-- list of allowed flags (value ones will be added) +</span> +<span class="comment">-- More complex example using aliasses: +</span><span class="keyword">local</span> valid = { + long = <span class="string">"l"</span>, <span class="comment">-- if 'l' is specified, it is reported as 'long' +</span> new = { <span class="string">"n"</span>, <span class="string">"old"</span> }, <span class="comment">-- here both 'n' and 'old' will go into 'new' +</span>} +<span class="keyword">local</span> values = { + <span class="string">"value"</span>, <span class="comment">-- will automatically be added to the allowed set of flags +</span> <span class="string">"new"</span>, <span class="comment">-- will mark 'n' and 'old' as requiring a value as well +</span>} +<span class="keyword">local</span> flags, params = app.parse_args(<span class="keyword">nil</span>, values, valid) + +<span class="comment">-- command: myapp.lua -l --old:hello --value world param1 param2 +</span><span class="comment">-- will yield: +</span>flags = { + long = <span class="keyword">true</span>, <span class="comment">-- input from 'l' +</span> new = <span class="string">"hello"</span>, <span class="comment">-- input from 'old' +</span> value = <span class="string">"world"</span>, <span class="comment">-- allowed because it was in 'values', note: space separated! +</span>} +params = { + [<span class="number">1</span>] = <span class="string">"param1"</span> + [<span class="number">2</span>] = <span class="string">"param2"</span> +}</pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.array2d.html b/Data/Libraries/Penlight/docs/libraries/pl.array2d.html new file mode 100644 index 0000000..8ee905b --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.array2d.html @@ -0,0 +1,1319 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><strong>pl.array2d</strong></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.array2d</code></h1> +<p>Operations on two-dimensional arrays.</p> +<p> See <a href="../manual/02-arrays.md.html#Operations_on_two_dimensional_tables">The Guide</a></p> + +<p> The size of the arrays is determined by using the length operator <code>#</code> hence + the module is not <code>nil</code> safe, and the usual precautions apply.</p> + +<p> Note: all functions taking <code>i1,j1,i2,j2</code> as arguments will normalize the + arguments using <a href="../libraries/pl.array2d.html#default_range">default_range</a>.</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.tablex.html#">pl.tablex</a>, <a href="../libraries/pl.types.html#">pl.types</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#size">size (a)</a></td> + <td class="summary">return the row and column size.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#column">column (a, j)</a></td> + <td class="summary">extract a column from the 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#row">row (a, i)</a></td> + <td class="summary">extract a row from the 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map">map (f, a, arg)</a></td> + <td class="summary">map a function over a 2D array</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reduce_rows">reduce_rows (f, a)</a></td> + <td class="summary">reduce the rows using a function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reduce_cols">reduce_cols (f, a)</a></td> + <td class="summary">reduce the columns using a function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reduce2">reduce2 (opc, opr, a)</a></td> + <td class="summary">reduce a 2D array into a scalar, using two operations.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map2">map2 (f, ad, bd, a, b, arg)</a></td> + <td class="summary">map a function over two arrays.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#product">product (f, t1, t2)</a></td> + <td class="summary">cartesian product of two 1d arrays.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#flatten">flatten (t)</a></td> + <td class="summary">flatten a 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reshape">reshape (t, nrows, co)</a></td> + <td class="summary">reshape a 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#transpose">transpose (t)</a></td> + <td class="summary">transpose a 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#swap_rows">swap_rows (t, i1, i2)</a></td> + <td class="summary">swap two rows of an array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#swap_cols">swap_cols (t, j1, j2)</a></td> + <td class="summary">swap two columns of an array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#extract_rows">extract_rows (t, ridx)</a></td> + <td class="summary">extract the specified rows.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#extract_cols">extract_cols (t, cidx)</a></td> + <td class="summary">extract the specified columns.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#remove_row">remove_row (t, i)</a></td> + <td class="summary">remove a row from an array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#remove_col">remove_col (t, j)</a></td> + <td class="summary">remove a column from an array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#parse_range">parse_range (s)</a></td> + <td class="summary">parse a spreadsheet range.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#range">range (t, rstr)</a></td> + <td class="summary">get a slice of a 2D array using spreadsheet range notation.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#default_range">default_range (t, i1, j1, i2, j2)</a></td> + <td class="summary">normalizes coordinates to valid positive entries and defaults.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#slice">slice (t, i1, j1, i2, j2)</a></td> + <td class="summary">get a slice of a 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#set">set (t, value, i1, j1, i2, j2)</a></td> + <td class="summary">set a specified range of an array to a value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#write">write (t, f, fmt, i1, j1, i2, j2)</a></td> + <td class="summary">write a 2D array to a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#forall">forall (t, row_op, end_row_op, i1, j1, i2, j2)</a></td> + <td class="summary">perform an operation for all values in a 2D array.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#move">move (dest, di, dj, src, i1, j1, i2, j2)</a></td> + <td class="summary">move a block from the destination to the source.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#iter">iter (a, indices, i1, j1, i2, j2)</a></td> + <td class="summary">iterate over all elements in a 2D array, with optional indices.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#columns">columns (a)</a></td> + <td class="summary">iterate over all columns.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rows">rows (a)</a></td> + <td class="summary">iterate over all rows.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#new">new (rows, cols, val)</a></td> + <td class="summary">new array of specified dimensions</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "size"></a> + <strong>size (a)</strong> + </dt> + <dd> + return the row and column size. + Size is calculated using the Lua length operator #, so usual precautions + regarding <code>nil</code> values apply. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + a 2d array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + <span class="types"><span class="type">int</span></span> + number of rows (<code>#a</code>)</li> + <li> + <span class="types"><span class="type">int</span></span> + number of cols (<code>#a[1]</code>)</li> + </ol> + + + + +</dd> + <dt> + <a name = "column"></a> + <strong>column (a, j)</strong> + </dt> + <dd> + extract a column from the 2D array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">j</span> + column index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 1d array + </ol> + + + + +</dd> + <dt> + <a name = "row"></a> + <strong>row (a, i)</strong> + </dt> + <dd> + extract a row from the 2D array. + Added in line with <a href="../libraries/pl.array2d.html#column">column</a>, for read-only purposes directly + accessing a[i] is more performant. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">i</span> + row index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 1d array (copy of the row) + </ol> + + + + +</dd> + <dt> + <a name = "map"></a> + <strong>map (f, a, arg)</strong> + </dt> + <dd> + map a function over a 2D array + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + a function of at least one argument + </li> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">arg</span> + an optional extra argument to be passed to the function. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 2d array + </ol> + + + + +</dd> + <dt> + <a name = "reduce_rows"></a> + <strong>reduce_rows (f, a)</strong> + </dt> + <dd> + reduce the rows using a function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + a binary function + </li> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 1d array + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#reduce">pl.tablex.reduce</a> + </ul> + + +</dd> + <dt> + <a name = "reduce_cols"></a> + <strong>reduce_cols (f, a)</strong> + </dt> + <dd> + reduce the columns using a function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + a binary function + </li> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 1d array + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#reduce">pl.tablex.reduce</a> + </ul> + + +</dd> + <dt> + <a name = "reduce2"></a> + <strong>reduce2 (opc, opr, a)</strong> + </dt> + <dd> + reduce a 2D array into a scalar, using two operations. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">opc</span> + <span class="types"><span class="type">func</span></span> + operation to reduce the final result + </li> + <li><span class="parameter">opr</span> + <span class="types"><span class="type">func</span></span> + operation to reduce the rows + </li> + <li><span class="parameter">a</span> + 2D array + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "map2"></a> + <strong>map2 (f, ad, bd, a, b, arg)</strong> + </dt> + <dd> + map a function over two arrays. + They can be both or either 2D arrays + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + function of at least two arguments + </li> + <li><span class="parameter">ad</span> + <span class="types"><span class="type">int</span></span> + order of first array (<code>1</code> if <code>a</code> is a list/array, <code>2</code> if it is a 2d array) + </li> + <li><span class="parameter">bd</span> + <span class="types"><span class="type">int</span></span> + order of second array (<code>1</code> if <code>b</code> is a list/array, <code>2</code> if it is a 2d array) + </li> + <li><span class="parameter">a</span> + <span class="types"><span class="type">tab</span></span> + 1d or 2d array + </li> + <li><span class="parameter">b</span> + <span class="types"><span class="type">tab</span></span> + 1d or 2d array + </li> + <li><span class="parameter">arg</span> + optional extra argument to pass to function + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 2D array, unless both arrays are 1D + </ol> + + + + +</dd> + <dt> + <a name = "product"></a> + <strong>product (f, t1, t2)</strong> + </dt> + <dd> + cartesian product of two 1d arrays. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + a function of 2 arguments + </li> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">array</span></span> + a 1d table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">array</span></span> + a 1d table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + 2d table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">product(<span class="string">'..'</span>,{<span class="number">1</span>,<span class="number">2</span>},{<span class="string">'a'</span>,<span class="string">'b'</span>}) == {{<span class="string">'1a'</span>,<span class="string">'2a'</span>},{<span class="string">'1b'</span>,<span class="string">'2b'</span>}}</pre> + </ul> + +</dd> + <dt> + <a name = "flatten"></a> + <strong>flatten (t)</strong> + </dt> + <dd> + flatten a 2D array. + (this goes over columns first.) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2d table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a 1d table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">flatten {{<span class="number">1</span>,<span class="number">2</span>},{<span class="number">3</span>,<span class="number">4</span>},{<span class="number">5</span>,<span class="number">6</span>}} == {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "reshape"></a> + <strong>reshape (t, nrows, co)</strong> + </dt> + <dd> + reshape a 2D array. Reshape the aray by specifying a new nr of rows. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">nrows</span> + <span class="types"><span class="type">int</span></span> + new number of rows + </li> + <li><span class="parameter">co</span> + <span class="types"><span class="type">bool</span></span> + use column-order (Fortran-style) (default false) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new 2d array + </ol> + + + + +</dd> + <dt> + <a name = "transpose"></a> + <strong>transpose (t)</strong> + </dt> + <dd> + transpose a 2D array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new 2d array + </ol> + + + + +</dd> + <dt> + <a name = "swap_rows"></a> + <strong>swap_rows (t, i1, i2)</strong> + </dt> + <dd> + swap two rows of an array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2d array + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + a row index + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + a row index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + t (same, modified 2d array) + </ol> + + + + +</dd> + <dt> + <a name = "swap_cols"></a> + <strong>swap_cols (t, j1, j2)</strong> + </dt> + <dd> + swap two columns of an array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2d array + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + a column index + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + a column index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + t (same, modified 2d array) + </ol> + + + + +</dd> + <dt> + <a name = "extract_rows"></a> + <strong>extract_rows (t, ridx)</strong> + </dt> + <dd> + extract the specified rows. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">ridx</span> + <span class="types"><span class="type">{int}</span></span> + a table of row indices + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new 2d array with the extracted rows + </ol> + + + + +</dd> + <dt> + <a name = "extract_cols"></a> + <strong>extract_cols (t, cidx)</strong> + </dt> + <dd> + extract the specified columns. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2d array + </li> + <li><span class="parameter">cidx</span> + <span class="types"><span class="type">{int}</span></span> + a table of column indices + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new 2d array with the extracted colums + </ol> + + + + +</dd> + <dt> + <a name = "remove_row"></a> + <strong>remove_row (t, i)</strong> + </dt> + <dd> + remove a row from an array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2d array + </li> + <li><span class="parameter">i</span> + <span class="types"><span class="type">int</span></span> + a row index + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "remove_col"></a> + <strong>remove_col (t, j)</strong> + </dt> + <dd> + remove a column from an array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2d array + </li> + <li><span class="parameter">j</span> + <span class="types"><span class="type">int</span></span> + a column index + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "parse_range"></a> + <strong>parse_range (s)</strong> + </dt> + <dd> + parse a spreadsheet range. + The range can be specified either as 'A1:B2' or 'R1C1:R2C2'; + a special case is a single element (e.g 'A1' or 'R1C1') + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a range (case insensitive). + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + <span class="types"><span class="type">int</span></span> + start row</li> + <li> + <span class="types"><span class="type">int</span></span> + start col</li> + <li> + <span class="types"><span class="type">int</span></span> + end row</li> + <li> + <span class="types"><span class="type">int</span></span> + end col</li> + </ol> + + + + +</dd> + <dt> + <a name = "range"></a> + <strong>range (t, rstr)</strong> + </dt> + <dd> + get a slice of a 2D array using spreadsheet range notation. @see parse_range + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">rstr</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + range expression + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a slice + </ol> + + + <h3>See also:</h3> + <ul> + <li><a href="../libraries/pl.array2d.html#parse_range">array2d.parse_range</a></li> + <li><a href="../libraries/pl.array2d.html#slice">array2d.slice</a></li> + </ul> + + +</dd> + <dt> + <a name = "default_range"></a> + <strong>default_range (t, i1, j1, i2, j2)</strong> + </dt> + <dd> + normalizes coordinates to valid positive entries and defaults. + Negative indices will be counted from the end, too low, or too high + will be limited by the array sizes. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + return i1, j1, i2, j2 + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "slice"></a> + <strong>slice (t, i1, j1, i2, j2)</strong> + </dt> + <dd> + get a slice of a 2D array. Note that if the specified range has + a 1D result, the rank of the result will be 1. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an array, 2D in general but 1D in special cases. + </ol> + + + + +</dd> + <dt> + <a name = "set"></a> + <strong>set (t, value, i1, j1, i2, j2)</strong> + </dt> + <dd> + set a specified range of an array to a value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">value</span> + the value (may be a function, called as <code>val(i,j)</code>) + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#set">tablex.set</a> + </ul> + + +</dd> + <dt> + <a name = "write"></a> + <strong>write (t, f, fmt, i1, j1, i2, j2)</strong> + </dt> + <dd> + write a 2D array to a file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">f</span> + a file object (default stdout) + </li> + <li><span class="parameter">fmt</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a format string (default is just to use tostring) + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "forall"></a> + <strong>forall (t, row_op, end_row_op, i1, j1, i2, j2)</strong> + </dt> + <dd> + perform an operation for all values in a 2D array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + 2D array + </li> + <li><span class="parameter">row_op</span> + <span class="types"><span class="type">func</span></span> + function to call on each value; <code>row_op(row,j)</code> + </li> + <li><span class="parameter">end_row_op</span> + <span class="types"><span class="type">func</span></span> + function to call at end of each row; <code>end_row_op(i)</code> + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "move"></a> + <strong>move (dest, di, dj, src, i1, j1, i2, j2)</strong> + </dt> + <dd> + move a block from the destination to the source. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dest</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">di</span> + <span class="types"><span class="type">int</span></span> + start row in dest + </li> + <li><span class="parameter">dj</span> + <span class="types"><span class="type">int</span></span> + start col in dest + </li> + <li><span class="parameter">src</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "iter"></a> + <strong>iter (a, indices, i1, j1, i2, j2)</strong> + </dt> + <dd> + iterate over all elements in a 2D array, with optional indices. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + 2D array + </li> + <li><span class="parameter">indices</span> + <span class="types"><span class="type">bool</span></span> + with indices (default false) + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start row (default 1) + </li> + <li><span class="parameter">j1</span> + <span class="types"><span class="type">int</span></span> + start col (default 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end row (default N) + </li> + <li><span class="parameter">j2</span> + <span class="types"><span class="type">int</span></span> + end col (default M) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + either <code>value</code> or <code>i,j,value</code> depending on the value of <code>indices</code> + </ol> + + + + +</dd> + <dt> + <a name = "columns"></a> + <strong>columns (a)</strong> + </dt> + <dd> + iterate over all columns. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + column, column-index + </ol> + + + + +</dd> + <dt> + <a name = "rows"></a> + <strong>rows (a)</strong> + </dt> + <dd> + iterate over all rows. + Returns a copy of the row, for read-only purrposes directly iterating + is more performant; <code>ipairs(a)</code> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + <span class="types"><span class="type">array</span></span> + a 2D array + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + row, row-index + </ol> + + + + +</dd> + <dt> + <a name = "new"></a> + <strong>new (rows, cols, val)</strong> + </dt> + <dd> + new array of specified dimensions + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">rows</span> + <span class="types"><span class="type">int</span></span> + number of rows + </li> + <li><span class="parameter">cols</span> + <span class="types"><span class="type">int</span></span> + number of cols + </li> + <li><span class="parameter">val</span> + initial value; if it's a function then use <code>val(i,j)</code> + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + new 2d array + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.class.html b/Data/Libraries/Penlight/docs/libraries/pl.class.html new file mode 100644 index 0000000..b623e94 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.class.html @@ -0,0 +1,332 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><strong>pl.class</strong></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.class</code></h1> +<p>Provides a reuseable and convenient framework for creating classes in Lua.</p> +<p> Two possible notations:</p> + + +<pre> +B = class(A) +class.B(A) +</pre> + +<p> The latter form creates a named class within the current environment. Note + that this implicitly brings in <a href="../libraries/pl.utils.html#">pl.utils</a> as a dependency.</p> + +<p> See the Guide for further <a href="../manual/01-introduction.md.html#Simplifying_Object_Oriented_Programming_in_Lua">discussion</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#_init">_init (...)</a></td> + <td class="summary">initializes an <strong>instance</strong> upon creation.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#instance:is_a">instance:is_a (some_class)</a></td> + <td class="summary">checks whether an <strong>instance</strong> is derived from some class.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#some_class:class_of">some_class:class_of (some_instance)</a></td> + <td class="summary">checks whether an <strong>instance</strong> is derived from some class.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#some_class:cast">some_class:cast (some_instance)</a></td> + <td class="summary">cast an object to another class.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#class">class (base, c_arg, c)</a></td> + <td class="summary">create a new class, derived from a given base class.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "_init"></a> + <strong>_init (...)</strong> + </dt> + <dd> + initializes an <strong>instance</strong> upon creation. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + parameters passed to the constructor + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> Cat = class() +<span class="keyword">function</span> Cat:_init(name) + <span class="comment">--self:super(name) -- call the ancestor initializer if needed +</span> self.name = name +<span class="keyword">end</span> + +<span class="keyword">local</span> pussycat = Cat(<span class="string">"pussycat"</span>) +<span class="global">print</span>(pussycat.name) <span class="comment">--> pussycat</span></pre> + </ul> + +</dd> + <dt> + <a name = "instance:is_a"></a> + <strong>instance:is_a (some_class)</strong> + </dt> + <dd> + checks whether an <strong>instance</strong> is derived from some class. + Works the other way around as <a href="../libraries/pl.class.html#some_class:class_of">class_of</a>. It has two ways of using; + 1) call with a class to check against, 2) call without params. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">some_class</span> + class to check against, or <code>nil</code> to return the class + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if <code>instance</code> is derived from <code>some_class</code>, or if <code>some_class == nil</code> then + it returns the class table of the instance + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> pussycat = Lion() <span class="comment">-- assuming Lion derives from Cat +</span><span class="keyword">if</span> pussycat:is_a(Cat) <span class="keyword">then</span> + <span class="comment">-- it's true, it is a Lion, but also a Cat +</span><span class="keyword">end</span> + +<span class="keyword">if</span> pussycat:is_a() == Lion <span class="keyword">then</span> + <span class="comment">-- It's true +</span><span class="keyword">end</span></pre> + </ul> + +</dd> + <dt> + <a name = "some_class:class_of"></a> + <strong>some_class:class_of (some_instance)</strong> + </dt> + <dd> + checks whether an <strong>instance</strong> is derived from some class. + Works the other way around as <a href="../libraries/pl.class.html#instance:is_a">is_a</a>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">some_instance</span> + instance to check against + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if <code>some_instance</code> is derived from <code>some_class</code> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> pussycat = Lion() <span class="comment">-- assuming Lion derives from Cat +</span><span class="keyword">if</span> Cat:class_of(pussycat) <span class="keyword">then</span> + <span class="comment">-- it's true +</span><span class="keyword">end</span></pre> + </ul> + +</dd> + <dt> + <a name = "some_class:cast"></a> + <strong>some_class:cast (some_instance)</strong> + </dt> + <dd> + cast an object to another class. + It is not clever (or safe!) so use carefully. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">some_instance</span> + the object to be changed + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "class"></a> + <strong>class (base, c_arg, c)</strong> + </dt> + <dd> + create a new class, derived from a given base class. + Supporting two class creation syntaxes: + either <code>Name = class(base)</code> or <code>class.Name(base)</code>. + The first form returns the class directly and does not set its <code>_name</code>. + The second form creates a variable <code>Name</code> in the current environment set + to the class, and also sets <code>_name</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">base</span> + optional base class + </li> + <li><span class="parameter">c_arg</span> + optional parameter to class constructor + </li> + <li><span class="parameter">c</span> + optional table to be used as class + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.compat.html b/Data/Libraries/Penlight/docs/libraries/pl.compat.html new file mode 100644 index 0000000..6680030 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.compat.html @@ -0,0 +1,580 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Fields">Fields</a></li> +<li><a href="#Global_exported_functions__for_Lua_5_1___LuaJIT_">Global exported functions (for Lua 5.1 & LuaJIT) </a></li> +<li><a href="#Global_exported_functions__for_Lua___5_4_">Global exported functions (for Lua < 5.4) </a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><strong>pl.compat</strong></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.compat</code></h1> +<p>Lua 5.1/5.2/5.3 compatibility.</p> +<p> Injects <a href="../libraries/pl.compat.html#table.pack">table.pack</a>, <a href="../libraries/pl.compat.html#table.unpack">table.unpack</a>, and <a href="../libraries/pl.compat.html#package.searchpath">package.searchpath</a> in the global + environment, to make sure they are available for Lua 5.1 and LuaJIT.</p> + +<p> All other functions are exported as usual in the returned module table.</p> + +<p> NOTE: everything in this module is also available in <a href="../libraries/pl.utils.html#">pl.utils</a>.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#execute">execute (cmd)</a></td> + <td class="summary">execute a shell command, in a compatible and platform independent way.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#load">load (ld[, source[, mode[, env]]])</a></td> + <td class="summary">Load Lua code as a text or binary chunk (in a Lua 5.2 compatible way).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getfenv">getfenv (f)</a></td> + <td class="summary">Get environment of a function (in a Lua 5.1 compatible way).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#setfenv">setfenv (f, env)</a></td> + <td class="summary">Set environment of a function (in a Lua 5.1 compatible way).</td> + </tr> +</table> +<h2><a href="#Fields">Fields</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#lua51">lua51</a></td> + <td class="summary">boolean flag this is Lua 5.1 (or LuaJIT).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#jit">jit</a></td> + <td class="summary">boolean flag this is LuaJIT.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#jit52">jit52</a></td> + <td class="summary">boolean flag this is LuaJIT with 5.2 compatibility compiled in.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dir_separator">dir_separator</a></td> + <td class="summary">the directory separator character for the current platform.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_windows">is_windows</a></td> + <td class="summary">boolean flag this is a Windows platform.</td> + </tr> +</table> +<h2><a href="#Global_exported_functions__for_Lua_5_1___LuaJIT_">Global exported functions (for Lua 5.1 & LuaJIT) </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#table.pack">table.pack (...)</a></td> + <td class="summary">pack an argument list into a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#table.unpack">table.unpack (t[, i[, t]])</a></td> + <td class="summary">unpack a table and return the elements.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#package.searchpath">package.searchpath (name, path[, sep[, rep]])</a></td> + <td class="summary">return the full path where a file name would be matched.</td> + </tr> +</table> +<h2><a href="#Global_exported_functions__for_Lua___5_4_">Global exported functions (for Lua < 5.4) </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#warn">warn (...)</a></td> + <td class="summary">raise a warning message.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "execute"></a> + <strong>execute (cmd)</strong> + </dt> + <dd> + execute a shell command, in a compatible and platform independent way. + This is a compatibility function that returns the same for Lua 5.1 and + Lua 5.2+.</p> + +<p> NOTE: Windows systems can use signed 32bit integer exitcodes. Posix systems + only use exitcodes 0-255, anything else is undefined.</p> + +<p> NOTE2: In Lua 5.2 and 5.3 a Windows exitcode of -1 would not properly be + returned, this function will return it properly for all versions. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">cmd</span> + a shell command + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + true if successful</li> + <li> + actual return code</li> + </ol> + + + + +</dd> + <dt> + <a name = "load"></a> + <strong>load (ld[, source[, mode[, env]]])</strong> + </dt> + <dd> + Load Lua code as a text or binary chunk (in a Lua 5.2 compatible way). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">ld</span> + code string or loader + </li> + <li><span class="parameter">source</span> + name of chunk for errors + (<em>optional</em>) + </li> + <li><span class="parameter">mode</span> + 'b', 't' or 'bt' + (<em>optional</em>) + </li> + <li><span class="parameter">env</span> + environment to load the chunk in + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "getfenv"></a> + <strong>getfenv (f)</strong> + </dt> + <dd> + Get environment of a function (in a Lua 5.1 compatible way). + Not 100% compatible, so with Lua 5.2 it may return nil for a function with no + global references! + Based on code by <a href="http://lua-users.org/lists/lua-l/2010-06/msg00313.html">Sergey Rozhenko</a> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + a function or a call stack reference + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "setfenv"></a> + <strong>setfenv (f, env)</strong> + </dt> + <dd> + Set environment of a function (in a Lua 5.1 compatible way). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + a function or a call stack reference + </li> + <li><span class="parameter">env</span> + a table that becomes the new environment of <code>f</code> + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Fields"></a>Fields</h2> + + <dl class="function"> + <dt> + <a name = "lua51"></a> + <strong>lua51</strong> + </dt> + <dd> + boolean flag this is Lua 5.1 (or LuaJIT). + + + <ul> + <li><span class="parameter">lua51</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "jit"></a> + <strong>jit</strong> + </dt> + <dd> + boolean flag this is LuaJIT. + + + <ul> + <li><span class="parameter">jit</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "jit52"></a> + <strong>jit52</strong> + </dt> + <dd> + boolean flag this is LuaJIT with 5.2 compatibility compiled in. + + + <ul> + <li><span class="parameter">jit52</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "dir_separator"></a> + <strong>dir_separator</strong> + </dt> + <dd> + the directory separator character for the current platform. + + + <ul> + <li><span class="parameter">dir_separator</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "is_windows"></a> + <strong>is_windows</strong> + </dt> + <dd> + boolean flag this is a Windows platform. + + + <ul> + <li><span class="parameter">is_windows</span> + + + + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Global_exported_functions__for_Lua_5_1___LuaJIT_"></a>Global exported functions (for Lua 5.1 & LuaJIT) </h2> + + <dl class="function"> + <dt> + <a name = "table.pack"></a> + <strong>table.pack (...)</strong> + </dt> + <dd> + pack an argument list into a table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + any arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table with field n set to the length + </ol> + + + + +</dd> + <dt> + <a name = "table.unpack"></a> + <strong>table.unpack (t[, i[, t]])</strong> + </dt> + <dd> + unpack a table and return the elements. </p> + +<p> NOTE: this version does NOT honor the n field, and hence it is not nil-safe. + See <a href="../libraries/pl.utils.html#unpack">utils.unpack</a> for a version that is nil-safe. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + index of the last element to unpack, defaults to #t + (<em>optional</em>) + </li> + <li><span class="parameter">i</span> + index from which to start unpacking, defaults to 1 + (<em>optional</em>) + </li> + <li><span class="parameter">t</span> + index of the last element to unpack, defaults to #t + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + multiple return values from the table + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#unpack">utils.unpack</a> + </ul> + + +</dd> + <dt> + <a name = "package.searchpath"></a> + <strong>package.searchpath (name, path[, sep[, rep]])</strong> + </dt> + <dd> + return the full path where a file name would be matched. + This function was introduced in Lua 5.2, so this compatibility version + will be injected in Lua 5.1 engines. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + file name, possibly dotted + </li> + <li><span class="parameter">path</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a path-template in the same form as package.path or package.cpath + </li> + <li><span class="parameter">sep</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + template separate character to be replaced by path separator. Default: "." + (<em>optional</em>) + </li> + <li><span class="parameter">rep</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the path separator to use, defaults to system separator. Default; "/" on Unixes, "\" on Windows. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + on success: path of the file</li> + <li> + on failure: nil, error string listing paths tried</li> + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.path.html#package_path">path.package_path</a> + </ul> + + +</dd> +</dl> + <h2 class="section-header "><a name="Global_exported_functions__for_Lua___5_4_"></a>Global exported functions (for Lua < 5.4) </h2> + + <dl class="function"> + <dt> + <a name = "warn"></a> + <strong>warn (...)</strong> + </dt> + <dd> + raise a warning message. + This functions mimics the <a href="../libraries/pl.compat.html#warn">warn</a> function added in Lua 5.4. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + any arguments + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.comprehension.html b/Data/Libraries/Penlight/docs/libraries/pl.comprehension.html new file mode 100644 index 0000000..4c31b64 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.comprehension.html @@ -0,0 +1,165 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><strong>pl.comprehension</strong></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.comprehension</code></h1> +<p>List comprehensions implemented in Lua.</p> +<p> See the <a href="http://lua-users.org/wiki/ListComprehensions">wiki page</a></p> + + +<pre> +<span class="keyword">local</span> C= <span class="global">require</span> <span class="string">'pl.comprehension'</span> . new() + +C (<span class="string">'x for x=1,10'</span>) () +==> {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>,<span class="number">7</span>,<span class="number">8</span>,<span class="number">9</span>,<span class="number">10</span>} +C <span class="string">'x^2 for x=1,4'</span> () +==> {<span class="number">1</span>,<span class="number">4</span>,<span class="number">9</span>,<span class="number">16</span>} +C <span class="string">'{x,x^2} for x=1,4'</span> () +==> {{<span class="number">1</span>,<span class="number">1</span>},{<span class="number">2</span>,<span class="number">4</span>},{<span class="number">3</span>,<span class="number">9</span>},{<span class="number">4</span>,<span class="number">16</span>}} +C <span class="string">'2*x for x'</span> {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>} +==> {<span class="number">2</span>,<span class="number">4</span>,<span class="number">6</span>} +dbl = C <span class="string">'2*x for x'</span> +dbl {<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>} +==> {<span class="number">20</span>,<span class="number">40</span>,<span class="number">60</span>} +C <span class="string">'x for x if x % 2 == 0'</span> {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>} +==> {<span class="number">2</span>,<span class="number">4</span>} +C <span class="string">'{x,y} for x = 1,2 for y = 1,2'</span> () +==> {{<span class="number">1</span>,<span class="number">1</span>},{<span class="number">1</span>,<span class="number">2</span>},{<span class="number">2</span>,<span class="number">1</span>},{<span class="number">2</span>,<span class="number">2</span>}} +C <span class="string">'{x,y} for x for y'</span> ({<span class="number">1</span>,<span class="number">2</span>},{<span class="number">10</span>,<span class="number">20</span>}) +==> {{<span class="number">1</span>,<span class="number">10</span>},{<span class="number">1</span>,<span class="number">20</span>},{<span class="number">2</span>,<span class="number">10</span>},{<span class="number">2</span>,<span class="number">20</span>}} +<span class="global">assert</span>(C <span class="string">'sum(x^2 for x)'</span> {<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>} == <span class="number">2</span>^<span class="number">2</span>+<span class="number">3</span>^<span class="number">2</span>+<span class="number">4</span>^<span class="number">2</span>) +</pre> + +<p> (c) 2008 David Manura. Licensed under the same terms as Lua (MIT license).</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.luabalanced.html#">pl.luabalanced</a></p> + +<p> See <a href="../manual/07-functional.md.html#List_Comprehensions">the Guide</a></p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</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 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><strong>pl.config</strong></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.config</code></h1> +<p>Reads configuration files into a Lua table.</p> +<p> + +<p> Understands INI files, classic Unix config files, and simple + delimited columns of values. See <a href="../manual/06-data.md.html#Reading_Configuration_Files">the Guide</a></p> + + +<pre> +# test.config +# Read timeout <span class="keyword">in</span> seconds +read.timeout=<span class="number">10</span> +# Write timeout <span class="keyword">in</span> seconds +write.timeout=<span class="number">5</span> +#acceptable ports +ports = <span class="number">1002</span>,<span class="number">1003</span>,<span class="number">1004</span> + +<span class="comment">-- readconfig.lua +</span><span class="keyword">local</span> config = <span class="global">require</span> <span class="string">'config'</span> +<span class="keyword">local</span> t = config.read <span class="string">'test.config'</span> +<span class="global">print</span>(pretty.write(t)) + +### output ##### +{ + ports = { + <span class="number">1002</span>, + <span class="number">1003</span>, + <span class="number">1004</span> + }, + write_timeout = <span class="number">5</span>, + read_timeout = <span class="number">10</span> +} +</pre> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#lines">lines (file)</a></td> + <td class="summary">like io.lines(), but allows for lines to be continued with ''.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#read">read (file[, cnfg])</a></td> + <td class="summary">read a configuration file into a table</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "lines"></a> + <strong>lines (file)</strong> + </dt> + <dd> + like io.lines(), but allows for lines to be continued with ''. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + a file-like object (anything where read() returns the next line) or a filename. + Defaults to stardard input. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + an iterator over the lines, or nil</li> + <li> + error 'not a file-like object' or 'file is nil'</li> + </ol> + + + + +</dd> + <dt> + <a name = "read"></a> + <strong>read (file[, cnfg])</strong> + </dt> + <dd> + read a configuration file into a table + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + either a file-like object or a string, which must be a filename + </li> + <li><span class="parameter">cnfg</span> + <span class="types"><span class="type">tab</span></span> + +<p> a configuration table that may contain these fields:</p> + +<ul> + <li><code>smart</code> try to deduce what kind of config file we have (default false)</li> + <li><code>variabilize</code> make names into valid Lua identifiers (default true)</li> + <li><code>convert_numbers</code> try to convert values into numbers (default true)</li> + <li><code>trim_space</code> ensure that there is no starting or trailing whitespace with values (default true)</li> + <li><code>trim_quotes</code> remove quotes from strings (default false)</li> + <li><code>list_delim</code> delimiter to use when separating columns (default ',')</li> + <li><code>keysep</code> separator between key and value pairs (default '=')</li> +</ul> + + + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a table containing items, or <code>nil</code></li> + <li> + error message (same as <a href="../libraries/pl.config.html#lines">config.lines</a></li> + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.data.html b/Data/Libraries/Penlight/docs/libraries/pl.data.html new file mode 100644 index 0000000..736e82e --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.data.html @@ -0,0 +1,571 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><strong>pl.data</strong></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.data</code></h1> +<p>Reading and querying simple tabular data.</p> +<p> + + + +<pre> +data.read <span class="string">'test.txt'</span> +==> {{<span class="number">10</span>,<span class="number">20</span>},{<span class="number">2</span>,<span class="number">5</span>},{<span class="number">40</span>,<span class="number">50</span>},fieldnames={<span class="string">'x'</span>,<span class="string">'y'</span>},delim=<span class="string">','</span>} +</pre> + +<p> Provides a way of creating basic SQL-like queries.</p> + + +<pre> +<span class="global">require</span> <span class="string">'pl'</span> +<span class="keyword">local</span> d = data.read(<span class="string">'xyz.txt'</span>) +<span class="keyword">local</span> q = d:<span class="global">select</span>(<span class="string">'x,y,z where x > 3 and z < 2 sort by y'</span>) +<span class="keyword">for</span> x,y,z <span class="keyword">in</span> q <span class="keyword">do</span> + <span class="global">print</span>(x,y,z) +<span class="keyword">end</span> +</pre> + +<p> See <a href="../manual/06-data.md.html#Reading_Columnar_Data">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.array2d.html#">pl.array2d</a> (fallback methods)</p> +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#Data.column_by_name">Data.column_by_name (name)</a></td> + <td class="summary">return a particular column as a list of values (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.select">Data.select (condn)</a></td> + <td class="summary">return a query iterator on this data (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.select_row">Data.select_row (condn)</a></td> + <td class="summary">return a row iterator on this data (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.copy_select">Data.copy_select (condn)</a></td> + <td class="summary">return a new data object based on this query (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.column_names">Data.column_names ()</a></td> + <td class="summary">return the field names of this data object (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.write_row">Data.write_row (f)</a></td> + <td class="summary">write out a row (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Data.write">Data.write (f)</a></td> + <td class="summary">write data out to file (method).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#read">read (file, cnfg)</a></td> + <td class="summary">read a delimited file in a Lua table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#write">write (data, file[, fieldnames[, delim='\t']])</a></td> + <td class="summary">write 2D data to a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#new">new (d[, fieldnames])</a></td> + <td class="summary">create a new dataset from a table of rows.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#query">query (data, condn, context, return_row)</a></td> + <td class="summary">create a query iterator from a select string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#filter">filter (Q, infile, outfile, dont_fail)</a></td> + <td class="summary">Filter input using a query.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "Data.column_by_name"></a> + <strong>Data.column_by_name (name)</strong> + </dt> + <dd> + return a particular column as a list of values (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + either name of column, or numerical index. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Data.select"></a> + <strong>Data.select (condn)</strong> + </dt> + <dd> + return a query iterator on this data (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">condn</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the query expression + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.data.html#query">data.query</a> + </ul> + + +</dd> + <dt> + <a name = "Data.select_row"></a> + <strong>Data.select_row (condn)</strong> + </dt> + <dd> + return a row iterator on this data (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">condn</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the query expression + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Data.copy_select"></a> + <strong>Data.copy_select (condn)</strong> + </dt> + <dd> + return a new data object based on this query (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">condn</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the query expression + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Data.column_names"></a> + <strong>Data.column_names ()</strong> + </dt> + <dd> + return the field names of this data object (method). + + + + + + + +</dd> + <dt> + <a name = "Data.write_row"></a> + <strong>Data.write_row (f)</strong> + </dt> + <dd> + write out a row (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + file-like object + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Data.write"></a> + <strong>Data.write (f)</strong> + </dt> + <dd> + write data out to file (method). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + file-like object + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "read"></a> + <strong>read (file, cnfg)</strong> + </dt> + <dd> + read a delimited file in a Lua table. + By default, attempts to treat first line as separated list of fieldnames. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + a filename or a file-like object + </li> + <li><span class="parameter">cnfg</span> parsing options + <ul> + <li><span class="parameter">delim</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string pattern to split fields + </li> + <li><span class="parameter">fieldnames</span> + <span class="types"><span class="type">array</span></span> + (i.e. don't read from first line) + </li> + <li><span class="parameter">no_convert</span> + <span class="types"><span class="type">bool</span></span> + (default is to try conversion on first data line) + </li> + <li><span class="parameter">convert</span> + <span class="types"><span class="type">tab</span></span> + table of custom conversion functions with column keys + </li> + <li><span class="parameter">numfields</span> + <span class="types"><span class="type">int</span></span> + indices of columns known to be numbers + </li> + <li><span class="parameter">last_field_collect</span> + <span class="types"><span class="type">bool</span></span> + only split as many fields as fieldnames. + </li> + <li><span class="parameter">thousands_dot</span> + <span class="types"><span class="type">int</span></span> + thousands separator in Excel CSV is '.' + </li> + <li><span class="parameter">csv</span> + <span class="types"><span class="type">bool</span></span> + fields may be double-quoted and contain commas; + Also, empty fields are considered to be equivalent to zero. + </li> + </li></ul> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + <a href="../libraries/pl.data.html">data</a> object, or <code>nil</code></li> + <li> + error message. May be a file error, 'not a file-like object' + or a conversion error</li> + </ol> + + + + +</dd> + <dt> + <a name = "write"></a> + <strong>write (data, file[, fieldnames[, delim='\t']])</strong> + </dt> + <dd> + write 2D data to a file. + Does not assume that the data has actually been + generated with <a href="../libraries/pl.data.html#new">new</a> or <a href="../libraries/pl.data.html#read">read</a>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">data</span> + 2D array + </li> + <li><span class="parameter">file</span> + filename or file-like object + </li> + <li><span class="parameter">fieldnames</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + list of fields (optional) + (<em>optional</em>) + </li> + <li><span class="parameter">delim</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + delimiter (default tab) + (<em>default</em> '\t') + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or nil, error + </ol> + + + + +</dd> + <dt> + <a name = "new"></a> + <strong>new (d[, fieldnames])</strong> + </dt> + <dd> + create a new dataset from a table of rows. + Can specify the fieldnames, else the table must have a field called + 'fieldnames', which is either a string of delimiter-separated names, + or a table of names. <br> + If the table does not have a field called 'delim', then an attempt will be + made to guess it from the fieldnames string, defaults otherwise to tab. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">d</span> + the table. + </li> + <li><span class="parameter">fieldnames</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + optional fieldnames + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the table. + </ol> + + + + +</dd> + <dt> + <a name = "query"></a> + <strong>query (data, condn, context, return_row)</strong> + </dt> + <dd> + create a query iterator from a select string. + Select string has this format: <br> + FIELDLIST [ where LUA-CONDN [ sort by FIELD] ]<br> + FIELDLIST is a comma-separated list of valid fields, or '*'. <br> <br> + The condition can also be a table, with fields 'fields' (comma-sep string or + table), 'sort_by' (string) and 'where' (Lua expression string or function) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">data</span> + table produced by read + </li> + <li><span class="parameter">condn</span> + select string or table + </li> + <li><span class="parameter">context</span> + a list of tables to be searched when resolving functions + </li> + <li><span class="parameter">return_row</span> + if true, wrap the results in a row table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + an iterator over the specified fields, or nil</li> + <li> + an error message</li> + </ol> + + + + +</dd> + <dt> + <a name = "filter"></a> + <strong>filter (Q, infile, outfile, dont_fail)</strong> + </dt> + <dd> + Filter input using a query. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">Q</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a query string + </li> + <li><span class="parameter">infile</span> + filename or file-like object + </li> + <li><span class="parameter">outfile</span> + filename or file-like object + </li> + <li><span class="parameter">dont_fail</span> + <span class="types"><span class="type">bool</span></span> + true if you want to return an error, not just fail + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.dir.html b/Data/Libraries/Penlight/docs/libraries/pl.dir.html new file mode 100644 index 0000000..5dfa0f6 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.dir.html @@ -0,0 +1,615 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><strong>pl.dir</strong></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.dir</code></h1> +<p>Listing files in directories and creating/removing directory paths.</p> +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.path.html#">pl.path</a></p> + +<p> Soft Dependencies: <code>alien</code>, <code>ffi</code> (either are used on Windows for copying/moving files)</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#fnmatch">fnmatch (filename, pattern)</a></td> + <td class="summary">Test whether a file name matches a shell pattern.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#filter">filter (filenames, pattern)</a></td> + <td class="summary">Return a list of all file names within an array which match a pattern.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getfiles">getfiles (dirname, mask)</a></td> + <td class="summary">return a list of all files in a directory which match a shell pattern.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getdirectories">getdirectories (dirname)</a></td> + <td class="summary">return a list of all subdirectories of the directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copyfile">copyfile (src, dest, flag)</a></td> + <td class="summary">copy a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#movefile">movefile (src, dest)</a></td> + <td class="summary">move a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#walk">walk (root, bottom_up, follow_links)</a></td> + <td class="summary">return an iterator which walks through a directory tree starting at root.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rmtree">rmtree (fullpath)</a></td> + <td class="summary">remove a whole directory tree.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#makepath">makepath (p)</a></td> + <td class="summary">create a directory path.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#clonetree">clonetree (path1, path2, file_fun, verbose)</a></td> + <td class="summary">clone a directory tree.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dirtree">dirtree (d)</a></td> + <td class="summary">return an iterator over all entries in a directory tree</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getallfiles">getallfiles (start_path, shell_pattern)</a></td> + <td class="summary">Recursively returns all the file starting at <em>path</em>.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "fnmatch"></a> + <strong>fnmatch (filename, pattern)</strong> + </dt> + <dd> + Test whether a file name matches a shell pattern. + Both parameters are case-normalized if operating system is + case-insensitive. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filename</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file name. + </li> + <li><span class="parameter">pattern</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A shell pattern. The only special characters are + <code>'*'</code> and <code>'?'</code>: <code>'*'</code> matches any sequence of characters and + <code>'?'</code> matches any single character. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">bool</span></span> + + + + </ol> + + <h3>Raises:</h3> + dir and mask must be strings + + + +</dd> + <dt> + <a name = "filter"></a> + <strong>filter (filenames, pattern)</strong> + </dt> + <dd> + Return a list of all file names within an array which match a pattern. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filenames</span> + <span class="types"><span class="type">tab</span></span> + An array containing file names. + </li> + <li><span class="parameter">pattern</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A shell pattern. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="../classes/pl.List.html">List(string)</a></span> + List of matching file names. + </ol> + + <h3>Raises:</h3> + dir and mask must be strings + + + +</dd> + <dt> + <a name = "getfiles"></a> + <strong>getfiles (dirname, mask)</strong> + </dt> + <dd> + return a list of all files in a directory which match a shell pattern. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dirname</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A directory. If not given, all files in current directory are returned. + </li> + <li><span class="parameter">mask</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A shell pattern. If not given, all files are returned. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + list of files + </ol> + + <h3>Raises:</h3> + dirname and mask must be strings + + + +</dd> + <dt> + <a name = "getdirectories"></a> + <strong>getdirectories (dirname)</strong> + </dt> + <dd> + return a list of all subdirectories of the directory. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dirname</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A directory + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + a list of directories + </ol> + + <h3>Raises:</h3> + dir must be a a valid directory + + + +</dd> + <dt> + <a name = "copyfile"></a> + <strong>copyfile (src, dest, flag)</strong> + </dt> + <dd> + copy a file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">src</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + source file + </li> + <li><span class="parameter">dest</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + destination file or directory + </li> + <li><span class="parameter">flag</span> + <span class="types"><span class="type">bool</span></span> + true if you want to force the copy (default) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">bool</span></span> + operation succeeded + </ol> + + <h3>Raises:</h3> + src and dest must be strings + + + +</dd> + <dt> + <a name = "movefile"></a> + <strong>movefile (src, dest)</strong> + </dt> + <dd> + move a file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">src</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + source file + </li> + <li><span class="parameter">dest</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + destination file or directory + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">bool</span></span> + operation succeeded + </ol> + + <h3>Raises:</h3> + src and dest must be strings + + + +</dd> + <dt> + <a name = "walk"></a> + <strong>walk (root, bottom_up, follow_links)</strong> + </dt> + <dd> + return an iterator which walks through a directory tree starting at root. + The iterator returns (root,dirs,files) + Note that dirs and files are lists of names (i.e. you must say path.join(root,d) + to get the actual full path) + If bottom_up is false (or not present), then the entries at the current level are returned + before we go deeper. This means that you can modify the returned list of directories before + continuing. + This is a clone of os.walk from the Python libraries. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">root</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A starting directory + </li> + <li><span class="parameter">bottom_up</span> + <span class="types"><span class="type">bool</span></span> + False if we start listing entries immediately. + </li> + <li><span class="parameter">follow_links</span> + <span class="types"><span class="type">bool</span></span> + follow symbolic links + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator returning root,dirs,files + </ol> + + <h3>Raises:</h3> + root must be a directory + + + +</dd> + <dt> + <a name = "rmtree"></a> + <strong>rmtree (fullpath)</strong> + </dt> + <dd> + remove a whole directory tree. + Symlinks in the tree will be deleted without following them. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fullpath</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A directory path (must be an actual directory, not a symlink) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + true or nil</li> + <li> + error if failed</li> + </ol> + + <h3>Raises:</h3> + fullpath must be a string + + + +</dd> + <dt> + <a name = "makepath"></a> + <strong>makepath (p)</strong> + </dt> + <dd> + create a directory path. + This will create subdirectories as necessary! + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">p</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A directory path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true on success, nil + errormsg on failure + </ol> + + <h3>Raises:</h3> + failure to create + + + +</dd> + <dt> + <a name = "clonetree"></a> + <strong>clonetree (path1, path2, file_fun, verbose)</strong> + </dt> + <dd> + clone a directory tree. Will always try to create a new directory structure + if necessary. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">path1</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the base path of the source tree + </li> + <li><span class="parameter">path2</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the new base path for the destination + </li> + <li><span class="parameter">file_fun</span> + <span class="types"><span class="type">func</span></span> + an optional function to apply on all files + </li> + <li><span class="parameter">verbose</span> + <span class="types"><span class="type">bool</span></span> + an optional boolean to control the verbosity of the output. + It can also be a logging function that behaves like print() + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + true, or nil</li> + <li> + error message, or list of failed directory creations</li> + <li> + list of failed file operations</li> + </ol> + + <h3>Raises:</h3> + path1 and path2 must be strings + + + <h3>Usage:</h3> + <ul> + <pre class="example">clonetree(<span class="string">'.'</span>,<span class="string">'../backup'</span>,copyfile)</pre> + </ul> + +</dd> + <dt> + <a name = "dirtree"></a> + <strong>dirtree (d)</strong> + </dt> + <dd> + return an iterator over all entries in a directory tree + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">d</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a directory + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator giving pathname and mode (true for dir, false otherwise) + </ol> + + <h3>Raises:</h3> + d must be a non-empty string + + + +</dd> + <dt> + <a name = "getallfiles"></a> + <strong>getallfiles (start_path, shell_pattern)</strong> + </dt> + <dd> + Recursively returns all the file starting at <em>path</em>. It can optionally take a shell pattern and + only returns files that match <em>shell</em>pattern_. If a pattern is given it will do a case insensitive search. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">start_path</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A directory. If not given, all files in current directory are returned. + </li> + <li><span class="parameter">shell_pattern</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A shell pattern. If not given, all files are returned. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="../classes/pl.List.html">List(string)</a></span> + containing all the files found recursively starting at <em>path</em> and filtered by <em>shell</em>pattern_. + </ol> + + <h3>Raises:</h3> + start_path must be a directory + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.file.html b/Data/Libraries/Penlight/docs/libraries/pl.file.html new file mode 100644 index 0000000..bd36aca --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.file.html @@ -0,0 +1,301 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><strong>pl.file</strong></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.file</code></h1> +<p>File manipulation functions: reading, writing, moving and copying.</p> +<p> This module wraps a number of functions from other modules into a + file related module for convenience.</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.dir.html#">pl.dir</a>, <a href="../libraries/pl.path.html#">pl.path</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#read">read ()</a></td> + <td class="summary">return the contents of a file as a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#write">write ()</a></td> + <td class="summary">write a string to a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copy">copy ()</a></td> + <td class="summary">copy a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#move">move ()</a></td> + <td class="summary">move a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#access_time">access_time ()</a></td> + <td class="summary">Return the time of last access as the number of seconds since the epoch.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#creation_time">creation_time ()</a></td> + <td class="summary">Return when the file was created.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#modified_time">modified_time ()</a></td> + <td class="summary">Return the time of last modification.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#delete">delete ()</a></td> + <td class="summary">Delete a file.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "read"></a> + <strong>read ()</strong> + </dt> + <dd> + return the contents of a file as a string. + This function is a copy of <a href="../libraries/pl.utils.html#readfile">utils.readfile</a>. + + + + + + + +</dd> + <dt> + <a name = "write"></a> + <strong>write ()</strong> + </dt> + <dd> + write a string to a file. + This function is a copy of <a href="../libraries/pl.utils.html#writefile">utils.writefile</a>. + + + + + + + +</dd> + <dt> + <a name = "copy"></a> + <strong>copy ()</strong> + </dt> + <dd> + copy a file. + This function is a copy of <a href="../libraries/pl.dir.html#copyfile">dir.copyfile</a>. + + + + + + + +</dd> + <dt> + <a name = "move"></a> + <strong>move ()</strong> + </dt> + <dd> + move a file. + This function is a copy of <a href="../libraries/pl.dir.html#movefile">dir.movefile</a>. + + + + + + + +</dd> + <dt> + <a name = "access_time"></a> + <strong>access_time ()</strong> + </dt> + <dd> + Return the time of last access as the number of seconds since the epoch. + This function is a copy of <a href="../libraries/pl.path.html#getatime">path.getatime</a>. + + + + + + + +</dd> + <dt> + <a name = "creation_time"></a> + <strong>creation_time ()</strong> + </dt> + <dd> + Return when the file was created. + This function is a copy of <a href="../libraries/pl.path.html#getctime">path.getctime</a>. + + + + + + + +</dd> + <dt> + <a name = "modified_time"></a> + <strong>modified_time ()</strong> + </dt> + <dd> + Return the time of last modification. + This function is a copy of <a href="../libraries/pl.path.html#getmtime">path.getmtime</a>. + + + + + + + +</dd> + <dt> + <a name = "delete"></a> + <strong>delete ()</strong> + </dt> + <dd> + Delete a file. + This function is a copy of <a href="https://www.lua.org/manual/5.1/manual.html#pdf-os.remove">os.remove</a>. + + + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.func.html b/Data/Libraries/Penlight/docs/libraries/pl.func.html new file mode 100644 index 0000000..22e84a1 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.func.html @@ -0,0 +1,460 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><strong>pl.func</strong></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.func</code></h1> +<p>Functional helpers like composition, binding and placeholder expressions.</p> +<p> Placeholder expressions are useful for short anonymous functions, and were + inspired by the Boost Lambda library.</p> + + +<pre> +> utils.import <span class="string">'pl.func'</span> +> ls = List{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>} +> = ls:map(_1+<span class="number">1</span>) +{<span class="number">11</span>,<span class="number">21</span>,<span class="number">31</span>} +</pre> + +<p> They can also be used to <em>bind</em> particular arguments of a function.</p> + + +<pre> +> p = bind(<span class="global">print</span>,<span class="string">'start>'</span>,_0) +> p(<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>) +> start> <span class="number">10</span> <span class="number">20</span> <span class="number">30</span> +</pre> + +<p> See <a href="../manual/07-functional.md.html#Creating_Functions_from_Functions">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.tablex.html#">pl.tablex</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#import">import (tname, context)</a></td> + <td class="summary">wrap a table of functions.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#register">register (fun[, name])</a></td> + <td class="summary">register a function for use in placeholder expressions.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#tail">tail (ls)</a></td> + <td class="summary">all elements of a table except the first.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#repr">repr (e, lastpred)</a></td> + <td class="summary">create a string representation of a placeholder expression.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#instantiate">instantiate (e)</a></td> + <td class="summary">instantiate a PE into an actual function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#I">I (e)</a></td> + <td class="summary">instantiate a PE unless it has already been done.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#bind1">bind1 (fn, p)</a></td> + <td class="summary">bind the first parameter of the function to a value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compose">compose (f, g)</a></td> + <td class="summary">create a function which chains two functions.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#bind">bind (fn, ...)</a></td> + <td class="summary">bind the arguments of a function to given values.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "import"></a> + <strong>import (tname, context)</strong> + </dt> + <dd> + wrap a table of functions. This makes them available for use in + placeholder expressions. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tname</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a table name + </li> + <li><span class="parameter">context</span> + <span class="types"><span class="type">tab</span></span> + context to put results, defaults to environment of caller + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "register"></a> + <strong>register (fun[, name])</strong> + </dt> + <dd> + register a function for use in placeholder expressions. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function + </li> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + an optional name + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a placeholder functiond + </ol> + + + + +</dd> + <dt> + <a name = "tail"></a> + <strong>tail (ls)</strong> + </dt> + <dd> + all elements of a table except the first. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">ls</span> + <span class="types"><span class="type">tab</span></span> + a list-like table. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "repr"></a> + <strong>repr (e, lastpred)</strong> + </dt> + <dd> + create a string representation of a placeholder expression. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">e</span> + a placeholder expression + </li> + <li><span class="parameter">lastpred</span> + not used + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "instantiate"></a> + <strong>instantiate (e)</strong> + </dt> + <dd> + instantiate a PE into an actual function. First we find the largest placeholder used, + e.g. <em>2; from this a list of the formal parameters can be build. Then we collect and replace + any non-PE values from the PE, and build up a constant binding list. + Finally, the expression can be compiled, and e.</em><em>PE</em>function is set. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">e</span> + a placeholder expression + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function + </ol> + + + + +</dd> + <dt> + <a name = "I"></a> + <strong>I (e)</strong> + </dt> + <dd> + instantiate a PE unless it has already been done. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">e</span> + a placeholder expression + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the function + </ol> + + + + +</dd> + <dt> + <a name = "bind1"></a> + <strong>bind1 (fn, p)</strong> + </dt> + <dd> + bind the first parameter of the function to a value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + <span class="types"><span class="type">func</span></span> + a function of one or more arguments + </li> + <li><span class="parameter">p</span> + a value + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function of one less argument + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">(bind1(<span class="global">math</span>.max,<span class="number">10</span>))(<span class="number">20</span>) == <span class="global">math</span>.max(<span class="number">10</span>,<span class="number">20</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "compose"></a> + <strong>compose (f, g)</strong> + </dt> + <dd> + create a function which chains two functions. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + a function of at least one argument + </li> + <li><span class="parameter">g</span> + <span class="types"><span class="type">func</span></span> + a function of at least one argument + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">printf = compose(<span class="global">io</span>.write,<span class="global">string</span>.format)</pre> + </ul> + +</dd> + <dt> + <a name = "bind"></a> + <strong>bind (fn, ...)</strong> + </dt> + <dd> + bind the arguments of a function to given values. + <code>bind(fn,v,_2)</code> is equivalent to <code>bind1(fn,v)</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + <span class="types"><span class="type">func</span></span> + a function of at least one argument + </li> + <li><span class="parameter">...</span> + values or placeholder variables + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">(bind(f,_1,a))(b) == f(a,b)</pre></li> + <li><pre class="example">(bind(f,_2,_1))(a,b) == f(b,a)</pre></li> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.html b/Data/Libraries/Penlight/docs/libraries/pl.html new file mode 100644 index 0000000..f3d134f --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.html @@ -0,0 +1,139 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><strong>pl</strong></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl</code></h1> +<p>Entry point for loading all PL libraries only on demand, into the global space.</p> +<p> Requiring 'pl' means that whenever a module is implicitly accesssed + (e.g. <a href="../libraries/pl.utils.html#split">utils.split</a>) + then that module is dynamically loaded. The submodules are all brought into + the global space. +Updated to use <a href="../libraries/pl.import_into.html#">pl.import_into</a></p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.import_into.html b/Data/Libraries/Penlight/docs/libraries/pl.import_into.html new file mode 100644 index 0000000..5f92459 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.import_into.html @@ -0,0 +1,142 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><strong>pl.import_into</strong></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.import_into</code></h1> +<p>PL loader, for loading all PL libraries, only on demand.</p> +<p> Whenever a module is implicitly accesssed, the table will have the module automatically injected. + (e.g. <code>_ENV.tablex</code>) + then that module is dynamically loaded. The submodules are all brought into + the table that is provided as the argument, or returned in a new table. + If a table is provided, that table's metatable is clobbered, but the values are not. + This module returns a single function, which is passed the environment. + If this is <code>true</code>, then return a 'shadow table' as the module + See <a href="../manual/01-introduction.md.html#To_Inject_or_not_to_Inject_">the Guide</a></p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.input.html b/Data/Libraries/Penlight/docs/libraries/pl.input.html new file mode 100644 index 0000000..d0086fd --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.input.html @@ -0,0 +1,336 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><strong>pl.input</strong></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.input</code></h1> +<p>Iterators for extracting words or numbers from an input source.</p> +<p> + + + +<pre> +<span class="global">require</span> <span class="string">'pl'</span> +<span class="keyword">local</span> total,n = seq.sum(input.numbers()) +<span class="global">print</span>(<span class="string">'average'</span>,total/n) +</pre> + +<p> <em>source</em> is defined as a string or a file-like object (i.e. has a read() method which returns the next line)</p> + +<p> See <a href="../manual/06-data.md.html#Reading_Unstructured_Text_Data">here</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a></p> +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#alltokens">alltokens (getter, pattern[, fn])</a></td> + <td class="summary">create an iterator over all tokens.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#create_getter">create_getter (f)</a></td> + <td class="summary">create a function which grabs the next value from a source.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#numbers">numbers (f)</a></td> + <td class="summary">generate a sequence of numbers from a source.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#words">words (f)</a></td> + <td class="summary">generate a sequence of words from a source.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#fields">fields (ids, delim, f, opts)</a></td> + <td class="summary">parse an input source into fields.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "alltokens"></a> + <strong>alltokens (getter, pattern[, fn])</strong> + </dt> + <dd> + create an iterator over all tokens. + based on allwords from PiL, 7.1 + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">getter</span> + <span class="types"><span class="type">func</span></span> + any function that returns a line of text + </li> + <li><span class="parameter">pattern</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + + + + </li> + <li><span class="parameter">fn</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + Optionally can pass a function to process each token as it's found. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator + </ol> + + + + +</dd> + <dt> + <a name = "create_getter"></a> + <strong>create_getter (f)</strong> + </dt> + <dd> + create a function which grabs the next value from a source. If the source is a string, then the getter + will return the string and thereafter return nil. If not specified then the source is assumed to be stdin. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + a string or a file-like object (i.e. has a read() method which returns the next line) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a getter function + </ol> + + + + +</dd> + <dt> + <a name = "numbers"></a> + <strong>numbers (f)</strong> + </dt> + <dd> + generate a sequence of numbers from a source. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + A source + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + An iterator + </ol> + + + + +</dd> + <dt> + <a name = "words"></a> + <strong>words (f)</strong> + </dt> + <dd> + generate a sequence of words from a source. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + A source + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + An iterator + </ol> + + + + +</dd> + <dt> + <a name = "fields"></a> + <strong>fields (ids, delim, f, opts)</strong> + </dt> + <dd> + parse an input source into fields. + By default, will fail if it cannot convert a field to a number. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">ids</span> + a list of field indices, or a maximum field index + </li> + <li><span class="parameter">delim</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + delimiter to parse fields (default space) + </li> + <li><span class="parameter">f</span> + a source @see create_getter + </li> + <li><span class="parameter">opts</span> + <span class="types"><span class="type">tab</span></span> + option table, <code>{no_fail=true}</code> + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator with the field values + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">for</span> x,y <span class="keyword">in</span> fields {<span class="number">2</span>,<span class="number">3</span>} <span class="keyword">do</span> <span class="global">print</span>(x,y) <span class="keyword">end</span> <span class="comment">-- 2nd and 3rd fields from stdin</span></pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.lapp.html b/Data/Libraries/Penlight/docs/libraries/pl.lapp.html new file mode 100644 index 0000000..24a1079 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.lapp.html @@ -0,0 +1,382 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Fields">Fields</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><strong>pl.lapp</strong></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.lapp</code></h1> +<p>Simple command-line parsing using human-readable specification.</p> +<p> Supports GNU-style parameters.</p> + + +<pre> +lapp = <span class="global">require</span> <span class="string">'pl.lapp'</span> +<span class="keyword">local</span> args = lapp <span class="string">[[ +Does some calculations + -o,--offset (default 0.0) Offset to add to scaled number + -s,--scale (number) Scaling factor + <number> (number) Number to be scaled +]]</span> + +<span class="global">print</span>(args.offset + args.scale * args.number) +</pre> + +<p> Lines beginning with <code>'-'</code> are flags; there may be a short and a long name; + lines beginning with <code>'<var>'</code> are arguments. Anything in parens after + the flag/argument is either a default, a type name or a range constraint.</p> + +<p> See <a href="../manual/08-additional.md.html#Command_line_Programs_with_Lapp">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.sip.html#">pl.sip</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#quit">quit (msg, no_usage)</a></td> + <td class="summary">quit this script immediately.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#error">error (msg, no_usage)</a></td> + <td class="summary">print an error to stderr and quit.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#open">open (file[, opt])</a></td> + <td class="summary">open a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#assert">assert (condn, msg)</a></td> + <td class="summary">quit if the condition is false.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#add_type">add_type (name, converter[, constraint])</a></td> + <td class="summary">add a new type to Lapp.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#process_options_string">process_options_string (str, args)</a></td> + <td class="summary">process a Lapp options string.</td> + </tr> +</table> +<h2><a href="#Fields">Fields</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#show_usage_error">show_usage_error</a></td> + <td class="summary">controls whether to dump usage on error.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "quit"></a> + <strong>quit (msg, no_usage)</strong> + </dt> + <dd> + quit this script immediately. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">msg</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + optional message + </li> + <li><span class="parameter">no_usage</span> + <span class="types"><span class="type">bool</span></span> + suppress 'usage' display + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "error"></a> + <strong>error (msg, no_usage)</strong> + </dt> + <dd> + print an error to stderr and quit. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">msg</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a message + </li> + <li><span class="parameter">no_usage</span> + <span class="types"><span class="type">bool</span></span> + suppress 'usage' display + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "open"></a> + <strong>open (file[, opt])</strong> + </dt> + <dd> + open a file. + This will quit on error, and keep a list of file objects for later cleanup. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + filename + </li> + <li><span class="parameter">opt</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + same as second parameter of <a href="https://www.lua.org/manual/5.1/manual.html#pdf-io.open">io.open</a> + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "assert"></a> + <strong>assert (condn, msg)</strong> + </dt> + <dd> + quit if the condition is false. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">condn</span> + <span class="types"><span class="type">bool</span></span> + a condition + </li> + <li><span class="parameter">msg</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + message text + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "add_type"></a> + <strong>add_type (name, converter[, constraint])</strong> + </dt> + <dd> + add a new type to Lapp. These appear in parens after the value like + a range constraint, e.g. '<ival> (integer) Process PID' + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + name of type + </li> + <li><span class="parameter">converter</span> + either a function to convert values, or a Lua type name. + </li> + <li><span class="parameter">constraint</span> + <span class="types"><span class="type">func</span></span> + optional function to verify values, should use lapp.error + if failed. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "process_options_string"></a> + <strong>process_options_string (str, args)</strong> + </dt> + <dd> + process a Lapp options string. + Usually called as <code>lapp()</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the options text + </li> + <li><span class="parameter">args</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">{string}</a></span> + a table of arguments (default is <code>_G.arg</code>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table with parameter-value pairs + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Fields"></a>Fields</h2> + + <dl class="function"> + <dt> + <a name = "show_usage_error"></a> + <strong>show_usage_error</strong> + </dt> + <dd> + controls whether to dump usage on error. + Defaults to true + + + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.lexer.html b/Data/Libraries/Penlight/docs/libraries/pl.lexer.html new file mode 100644 index 0000000..7b3d6fd --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.lexer.html @@ -0,0 +1,524 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><strong>pl.lexer</strong></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.lexer</code></h1> +<p>Lexical scanner for creating a sequence of tokens from text.</p> +<p> <code>lexer.scan(s)</code> returns an iterator over all tokens found in the + string <code>s</code>. This iterator returns two values, a token type string + (such as 'string' for quoted string, 'iden' for identifier) and the value of the + token.</p> + +<p> Versions specialized for Lua and C are available; these also handle block comments + and classify keywords as 'keyword' tokens. For example:</p> + + +<pre> +> s = <span class="string">'for i=1,n do'</span> +> <span class="keyword">for</span> t,v <span class="keyword">in</span> lexer.lua(s) <span class="keyword">do</span> <span class="global">print</span>(t,v) <span class="keyword">end</span> +keyword <span class="keyword">for</span> +iden i += = +number <span class="number">1</span> +, , +iden n +keyword <span class="keyword">do</span> +</pre> + +<p> See the Guide for further <a href="../manual/06-data.md.html#Lexical_Scanning">discussion</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#scan">scan (s, matches[, filter[, options]])</a></td> + <td class="summary">create a plain token iterator from a string or file-like object.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#insert">insert (tok, a1, a2)</a></td> + <td class="summary">insert tokens into a stream.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getline">getline (tok)</a></td> + <td class="summary">get everything in a stream upto a newline.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#lineno">lineno (tok)</a></td> + <td class="summary">get current line number.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getrest">getrest (tok)</a></td> + <td class="summary">get the rest of the stream.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#get_keywords">get_keywords ()</a></td> + <td class="summary">get the Lua keywords as a set-like table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#lua">lua (s[, filter[, options]])</a></td> + <td class="summary">create a Lua token iterator from a string or file-like object.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#cpp">cpp (s[, filter[, options]])</a></td> + <td class="summary">create a C/C++ token iterator from a string or file-like object.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#get_separated_list">get_separated_list (tok[, endtoken=')'[, delim=']])</a></td> + <td class="summary">get a list of parameters separated by a delimiter from a stream.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#skipws">skipws (tok)</a></td> + <td class="summary">get the next non-space token from the stream.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#expecting">expecting (tok, expected_type, no_skip_ws)</a></td> + <td class="summary">get the next token, which must be of the expected type.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "scan"></a> + <strong>scan (s, matches[, filter[, options]])</strong> + </dt> + <dd> + create a plain token iterator from a string or file-like object. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">file</span></span> + a string or a file-like object with <code>:read()</code> method returning lines. + </li> + <li><span class="parameter">matches</span> + <span class="types"><span class="type">tab</span></span> + an optional match table - array of token descriptions. + A token is described by a <code>{pattern, action}</code> pair, where <code>pattern</code> should match + token body and <code>action</code> is a function called when a token of described type is found. + </li> + <li><span class="parameter">filter</span> + <span class="types"><span class="type">tab</span></span> + a table of token types to exclude, by default <code>{space=true}</code> + (<em>optional</em>) + </li> + <li><span class="parameter">options</span> + <span class="types"><span class="type">tab</span></span> + a table of options; by default, <code>{number=true,string=true}</code>, + which means convert numbers and strip string quotes. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "insert"></a> + <strong>insert (tok, a1, a2)</strong> + </dt> + <dd> + insert tokens into a stream. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + a token stream + </li> + <li><span class="parameter">a1</span> + a string is the type, a table is a token list and + a function is assumed to be a token-like iterator (returns type & value) + </li> + <li><span class="parameter">a2</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string is the value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "getline"></a> + <strong>getline (tok)</strong> + </dt> + <dd> + get everything in a stream upto a newline. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + a token stream + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string + </ol> + + + + +</dd> + <dt> + <a name = "lineno"></a> + <strong>lineno (tok)</strong> + </dt> + <dd> + get current line number. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + a token stream + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the line number. + if the input source is a file-like object, + also return the column. + </ol> + + + + +</dd> + <dt> + <a name = "getrest"></a> + <strong>getrest (tok)</strong> + </dt> + <dd> + get the rest of the stream. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + a token stream + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string + </ol> + + + + +</dd> + <dt> + <a name = "get_keywords"></a> + <strong>get_keywords ()</strong> + </dt> + <dd> + get the Lua keywords as a set-like table. + So <code>res["and"]</code> etc would be <code>true</code>. + + + + <h3>Returns:</h3> + <ol> + + a table + </ol> + + + + +</dd> + <dt> + <a name = "lua"></a> + <strong>lua (s[, filter[, options]])</strong> + </dt> + <dd> + create a Lua token iterator from a string or file-like object. + Will return the token type and value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">filter</span> + <span class="types"><span class="type">tab</span></span> + a table of token types to exclude, by default <code>{space=true,comments=true}</code> + (<em>optional</em>) + </li> + <li><span class="parameter">options</span> + <span class="types"><span class="type">tab</span></span> + a table of options; by default, <code>{number=true,string=true}</code>, + which means convert numbers and strip string quotes. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "cpp"></a> + <strong>cpp (s[, filter[, options]])</strong> + </dt> + <dd> + create a C/C++ token iterator from a string or file-like object. + Will return the token type type and value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">filter</span> + <span class="types"><span class="type">tab</span></span> + a table of token types to exclude, by default <code>{space=true,comments=true}</code> + (<em>optional</em>) + </li> + <li><span class="parameter">options</span> + <span class="types"><span class="type">tab</span></span> + a table of options; by default, <code>{number=true,string=true}</code>, + which means convert numbers and strip string quotes. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "get_separated_list"></a> + <strong>get_separated_list (tok[, endtoken=')'[, delim=']])</strong> + </dt> + <dd> + get a list of parameters separated by a delimiter from a stream. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + the token stream + </li> + <li><span class="parameter">endtoken</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + end of list. Can be '\n' + (<em>default</em> ')') + </li> + <li><span class="parameter">delim</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + separator + (<em>default</em> ') + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list of token lists. + </ol> + + + + +</dd> + <dt> + <a name = "skipws"></a> + <strong>skipws (tok)</strong> + </dt> + <dd> + get the next non-space token from the stream. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + the token stream. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "expecting"></a> + <strong>expecting (tok, expected_type, no_skip_ws)</strong> + </dt> + <dd> + get the next token, which must be of the expected type. + Throws an error if this type does not match! + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tok</span> + the token stream + </li> + <li><span class="parameter">expected_type</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the token type + </li> + <li><span class="parameter">no_skip_ws</span> + <span class="types"><span class="type">bool</span></span> + whether we should skip whitespace + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.luabalanced.html b/Data/Libraries/Penlight/docs/libraries/pl.luabalanced.html new file mode 100644 index 0000000..48f6c63 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.luabalanced.html @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><strong>pl.luabalanced</strong></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.luabalanced</code></h1> +<p>Extract delimited Lua sequences from strings.</p> +<p> Inspired by Damian Conway's Text::Balanced in Perl. <br/> + <ul> + <li>[1] <a href="http://lua-users.org/wiki/LuaBalanced">Lua Wiki Page</a></li> + <li>[2] http://search.cpan.org/dist/Text-Balanced/lib/Text/Balanced.pm</li> + </ul> <br/> + <pre class=example> + local lb = require "pl.luabalanced" + --Extract Lua expression starting at position 4. + print(lb.match_expression("if x^2 + x > 5 then print(x) end", 4)) + --> x^2 + x > 5 16 + --Extract Lua string starting at (default) position 1. + print(lb.match_string([["test\"123" .. "more"]])) + --> "test\"123" 12 + </pre> + (c) 2008, David Manura, Licensed under the same terms as Lua (MIT license).</p> + + + +<br/> +<br/> + + + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.operator.html b/Data/Libraries/Penlight/docs/libraries/pl.operator.html new file mode 100644 index 0000000..fdd4cfb --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.operator.html @@ -0,0 +1,819 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Tables">Tables</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><strong>pl.operator</strong></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.operator</code></h1> +<p>Lua operators available as functions.</p> +<p> (similar to the Python module of the same name)</p> + +<p> There is a module field <a href="../libraries/pl.operator.html#optable">optable</a> which maps the operator strings + onto these functions, e.g. <code>operator.optable['()']==operator.call</code></p> + +<p> Operator strings like '>' and '{}' can be passed to most Penlight functions + expecting a function argument.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#call">call (fn, ...)</a></td> + <td class="summary">apply function to some arguments <strong>()</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#index">index (t, k)</a></td> + <td class="summary">get the indexed value from a table <strong>[]</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#eq">eq (a, b)</a></td> + <td class="summary">returns true if arguments are equal <strong>==</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#neq">neq (a, b)</a></td> + <td class="summary">returns true if arguments are not equal <strong>~=</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#lt">lt (a, b)</a></td> + <td class="summary">returns true if a is less than b <strong><</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#le">le (a, b)</a></td> + <td class="summary">returns true if a is less or equal to b <strong><=</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#gt">gt (a, b)</a></td> + <td class="summary">returns true if a is greater than b <strong>></strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#ge">ge (a, b)</a></td> + <td class="summary">returns true if a is greater or equal to b <strong>>=</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#len">len (a)</a></td> + <td class="summary">returns length of string or table <strong>#</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#add">add (a, b)</a></td> + <td class="summary">add two values <strong>+</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#sub">sub (a, b)</a></td> + <td class="summary">subtract b from a <strong>-</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#mul">mul (a, b)</a></td> + <td class="summary">multiply two values <strong>*</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#div">div (a, b)</a></td> + <td class="summary">divide first value by second <strong>/</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#pow">pow (a, b)</a></td> + <td class="summary">raise first to the power of second <strong>^</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#mod">mod (a, b)</a></td> + <td class="summary">modulo; remainder of a divided by b <strong>%</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#concat">concat (a, b)</a></td> + <td class="summary">concatenate two values (either strings or <code>__concat</code> defined) <strong>..</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#unm">unm (a)</a></td> + <td class="summary">return the negative of a value <strong>-</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#lnot">lnot (a)</a></td> + <td class="summary">false if value evaluates as true <strong>not</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#land">land (a, b)</a></td> + <td class="summary">true if both values evaluate as true <strong>and</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#lor">lor (a, b)</a></td> + <td class="summary">true if either value evaluate as true <strong>or</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#table">table (...)</a></td> + <td class="summary">make a table from the arguments <strong>{}</strong></td> + </tr> + <tr> + <td class="name" nowrap><a href="#match">match (a, b)</a></td> + <td class="summary">match two strings <strong>~</strong>.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#nop">nop (...)</a></td> + <td class="summary">the null operation.</td> + </tr> +</table> +<h2><a href="#Tables">Tables</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#optable">optable</a></td> + <td class="summary">Map from operator symbol to function.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "call"></a> + <strong>call (fn, ...)</strong> + </dt> + <dd> + apply function to some arguments <strong>()</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + a function or callable object + </li> + <li><span class="parameter">...</span> + arguments + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "index"></a> + <strong>index (t, k)</strong> + </dt> + <dd> + get the indexed value from a table <strong>[]</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + a table or any indexable object + </li> + <li><span class="parameter">k</span> + the key + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "eq"></a> + <strong>eq (a, b)</strong> + </dt> + <dd> + returns true if arguments are equal <strong>==</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "neq"></a> + <strong>neq (a, b)</strong> + </dt> + <dd> + returns true if arguments are not equal <strong>~=</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "lt"></a> + <strong>lt (a, b)</strong> + </dt> + <dd> + returns true if a is less than b <strong><</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "le"></a> + <strong>le (a, b)</strong> + </dt> + <dd> + returns true if a is less or equal to b <strong><=</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "gt"></a> + <strong>gt (a, b)</strong> + </dt> + <dd> + returns true if a is greater than b <strong>></strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "ge"></a> + <strong>ge (a, b)</strong> + </dt> + <dd> + returns true if a is greater or equal to b <strong>>=</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "len"></a> + <strong>len (a)</strong> + </dt> + <dd> + returns length of string or table <strong>#</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + a string or a table + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "add"></a> + <strong>add (a, b)</strong> + </dt> + <dd> + add two values <strong>+</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "sub"></a> + <strong>sub (a, b)</strong> + </dt> + <dd> + subtract b from a <strong>-</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "mul"></a> + <strong>mul (a, b)</strong> + </dt> + <dd> + multiply two values <strong>*</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "div"></a> + <strong>div (a, b)</strong> + </dt> + <dd> + divide first value by second <strong>/</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "pow"></a> + <strong>pow (a, b)</strong> + </dt> + <dd> + raise first to the power of second <strong>^</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "mod"></a> + <strong>mod (a, b)</strong> + </dt> + <dd> + modulo; remainder of a divided by b <strong>%</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "concat"></a> + <strong>concat (a, b)</strong> + </dt> + <dd> + concatenate two values (either strings or <code>__concat</code> defined) <strong>..</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "unm"></a> + <strong>unm (a)</strong> + </dt> + <dd> + return the negative of a value <strong>-</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "lnot"></a> + <strong>lnot (a)</strong> + </dt> + <dd> + false if value evaluates as true <strong>not</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "land"></a> + <strong>land (a, b)</strong> + </dt> + <dd> + true if both values evaluate as true <strong>and</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "lor"></a> + <strong>lor (a, b)</strong> + </dt> + <dd> + true if either value evaluate as true <strong>or</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + value + </li> + <li><span class="parameter">b</span> + value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "table"></a> + <strong>table (...)</strong> + </dt> + <dd> + make a table from the arguments <strong>{}</strong> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + non-nil arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table + </ol> + + + + +</dd> + <dt> + <a name = "match"></a> + <strong>match (a, b)</strong> + </dt> + <dd> + match two strings <strong>~</strong>. + uses <a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.find">string.find</a> + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + + + + </li> + <li><span class="parameter">b</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "nop"></a> + <strong>nop (...)</strong> + </dt> + <dd> + the null operation. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the arguments + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Tables"></a>Tables</h2> + + <dl class="function"> + <dt> + <a name = "optable"></a> + <strong>optable</strong> + </dt> + <dd> + +<p>Map from operator symbol to function. + Most of these map directly from operators; + But note these extras</p> + +<ul> + <li><strong>'()'</strong> <a href="../libraries/pl.operator.html#call">call</a></li> + <li><strong>'[]'</strong> <a href="../libraries/pl.operator.html#index">index</a></li> + <li><strong>'{}'</strong> <a href="../libraries/pl.operator.html#table">table</a></li> + <li><strong>'~'</strong> <a href="../libraries/pl.operator.html#match">match</a></li> +</ul> + + + + + <h3>Fields:</h3> + <ul> + <li><span class="parameter">operator</span> + + + + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.path.html b/Data/Libraries/Penlight/docs/libraries/pl.path.html new file mode 100644 index 0000000..6345f6b --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.path.html @@ -0,0 +1,1070 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Fields">Fields</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><strong>pl.path</strong></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.path</code></h1> +<p>Path manipulation and file queries.</p> +<p> This is modelled after Python's os.path library (10.1); see <a href="../manual/04-paths.md.html#">the Guide</a>.</p> + +<p> NOTE: the functions assume the paths being dealt with to originate + from the OS the application is running on. Windows drive letters are not + to be used when running on a Unix system for example. The one exception + is Windows paths to allow both forward and backward slashes (since Lua + also accepts those)</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="http://stevedonovan.github.io/lua-stdlibs/modules/lfs.html">lfs</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#dir">dir ()</a></td> + <td class="summary">Lua iterator over the entries of a given directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#mkdir">mkdir ()</a></td> + <td class="summary">Creates a directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rmdir">rmdir ()</a></td> + <td class="summary">Removes a directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#attrib">attrib ()</a></td> + <td class="summary">Gets attributes.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#currentdir">currentdir ()</a></td> + <td class="summary">Get the working directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#link_attrib">link_attrib ()</a></td> + <td class="summary">Gets symlink attributes.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#chdir">chdir ()</a></td> + <td class="summary">Changes the working directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isdir">isdir (P)</a></td> + <td class="summary">is this a directory?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isfile">isfile (P)</a></td> + <td class="summary">is this a file?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getsize">getsize (P)</a></td> + <td class="summary">return size of a file.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#exists">exists (P)</a></td> + <td class="summary">does a path exist?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getatime">getatime (P)</a></td> + <td class="summary">Return the time of last access as the number of seconds since the epoch.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getmtime">getmtime (P)</a></td> + <td class="summary">Return the time of last modification as the number of seconds since the epoch.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#getctime">getctime (P)</a></td> + <td class="summary">Return the system's ctime as the number of seconds since the epoch.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#splitpath">splitpath (P)</a></td> + <td class="summary">given a path, return the directory part and a file part.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#abspath">abspath (P[, pwd])</a></td> + <td class="summary">return an absolute path.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#splitext">splitext (P)</a></td> + <td class="summary">given a path, return the root part and the extension part.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dirname">dirname (P)</a></td> + <td class="summary">return the directory part of a path</td> + </tr> + <tr> + <td class="name" nowrap><a href="#basename">basename (P)</a></td> + <td class="summary">return the file part of a path</td> + </tr> + <tr> + <td class="name" nowrap><a href="#extension">extension (P)</a></td> + <td class="summary">get the extension part of a path.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isabs">isabs (P)</a></td> + <td class="summary">is this an absolute path?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#join">join (p1, p2, ...)</a></td> + <td class="summary">return the path resulting from combining the individual paths.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#normcase">normcase (P)</a></td> + <td class="summary">normalize the case of a pathname.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#normpath">normpath (P)</a></td> + <td class="summary">normalize a path name.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#relpath">relpath (P[, start])</a></td> + <td class="summary">relative path from current directory or optional start point</td> + </tr> + <tr> + <td class="name" nowrap><a href="#expanduser">expanduser (P)</a></td> + <td class="summary">Replace a starting '~' with the user's home directory.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#tmpname">tmpname ()</a></td> + <td class="summary">Return a suitable full path to a new temporary file name.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#common_prefix">common_prefix (path1, path2)</a></td> + <td class="summary">return the largest common prefix path of two paths.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#package_path">package_path (mod)</a></td> + <td class="summary">return the full path where a particular Lua module would be found.</td> + </tr> +</table> +<h2><a href="#Fields">Fields</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#is_windows">is_windows</a></td> + <td class="summary">are we running Windows?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sep">sep</a></td> + <td class="summary">path separator for this platform.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dirsep">dirsep</a></td> + <td class="summary">separator for PATH for this platform</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "dir"></a> + <strong>dir ()</strong> + </dt> + <dd> + Lua iterator over the entries of a given directory. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.dir</code></a> + + + + + + + +</dd> + <dt> + <a name = "mkdir"></a> + <strong>mkdir ()</strong> + </dt> + <dd> + Creates a directory. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.mkdir</code></a> + + + + + + + +</dd> + <dt> + <a name = "rmdir"></a> + <strong>rmdir ()</strong> + </dt> + <dd> + Removes a directory. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.rmdir</code></a> + + + + + + + +</dd> + <dt> + <a name = "attrib"></a> + <strong>attrib ()</strong> + </dt> + <dd> + Gets attributes. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.attributes</code></a> + + + + + + + +</dd> + <dt> + <a name = "currentdir"></a> + <strong>currentdir ()</strong> + </dt> + <dd> + Get the working directory. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.currentdir</code></a> + + + + + + + +</dd> + <dt> + <a name = "link_attrib"></a> + <strong>link_attrib ()</strong> + </dt> + <dd> + Gets symlink attributes. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.symlinkattributes</code></a> + + + + + + + +</dd> + <dt> + <a name = "chdir"></a> + <strong>chdir ()</strong> + </dt> + <dd> + Changes the working directory. + On Windows, if a drive is specified, it also changes the current drive. If + only specifying the drive, it will only switch drive, but not modify the path. + Implicit link to <a href="https://keplerproject.github.io/luafilesystem/manual.html#reference"><code>luafilesystem.chdir</code></a> + + + + + + + +</dd> + <dt> + <a name = "isdir"></a> + <strong>isdir (P)</strong> + </dt> + <dd> + is this a directory? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "isfile"></a> + <strong>isfile (P)</strong> + </dt> + <dd> + is this a file? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "getsize"></a> + <strong>getsize (P)</strong> + </dt> + <dd> + return size of a file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "exists"></a> + <strong>exists (P)</strong> + </dt> + <dd> + does a path exist? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the file path if it exists (either as file, directory, socket, etc), nil otherwise + </ol> + + + + +</dd> + <dt> + <a name = "getatime"></a> + <strong>getatime (P)</strong> + </dt> + <dd> + Return the time of last access as the number of seconds since the epoch. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "getmtime"></a> + <strong>getmtime (P)</strong> + </dt> + <dd> + Return the time of last modification as the number of seconds since the epoch. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "getctime"></a> + <strong>getctime (P)</strong> + </dt> + <dd> + Return the system's ctime as the number of seconds since the epoch. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "splitpath"></a> + <strong>splitpath (P)</strong> + </dt> + <dd> + given a path, return the directory part and a file part. + if there's no directory part, the first value will be empty + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + directory part</li> + <li> + file part</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> dir, file = path.splitpath(<span class="string">"some/dir/myfile.txt"</span>) +<span class="global">assert</span>(dir == <span class="string">"some/dir"</span>) +<span class="global">assert</span>(file == <span class="string">"myfile.txt"</span>) + +<span class="keyword">local</span> dir, file = path.splitpath(<span class="string">"some/dir/"</span>) +<span class="global">assert</span>(dir == <span class="string">"some/dir"</span>) +<span class="global">assert</span>(file == <span class="string">""</span>) + +<span class="keyword">local</span> dir, file = path.splitpath(<span class="string">"some_dir"</span>) +<span class="global">assert</span>(dir == <span class="string">""</span>) +<span class="global">assert</span>(file == <span class="string">"some_dir"</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "abspath"></a> + <strong>abspath (P[, pwd])</strong> + </dt> + <dd> + return an absolute path. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + <li><span class="parameter">pwd</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + optional start path to use (default is current dir) + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "splitext"></a> + <strong>splitext (P)</strong> + </dt> + <dd> + given a path, return the root part and the extension part. + if there's no extension part, the second value will be empty + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + root part (everything upto the "."", maybe empty)</li> + <li> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + extension part (including the ".", maybe empty)</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> file_path, ext = path.splitext(<span class="string">"/bonzo/dog_stuff/cat.txt"</span>) +<span class="global">assert</span>(file_path == <span class="string">"/bonzo/dog_stuff/cat"</span>) +<span class="global">assert</span>(ext == <span class="string">".txt"</span>) + +<span class="keyword">local</span> file_path, ext = path.splitext(<span class="string">""</span>) +<span class="global">assert</span>(file_path == <span class="string">""</span>) +<span class="global">assert</span>(ext == <span class="string">""</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "dirname"></a> + <strong>dirname (P)</strong> + </dt> + <dd> + return the directory part of a path + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + everything before the last dir-separator + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.path.html#splitpath">splitpath</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">path.dirname(<span class="string">"/some/path/file.txt"</span>) <span class="comment">-- "/some/path" +</span>path.dirname(<span class="string">"file.txt"</span>) <span class="comment">-- "" (empty string)</span></pre> + </ul> + +</dd> + <dt> + <a name = "basename"></a> + <strong>basename (P)</strong> + </dt> + <dd> + return the file part of a path + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + + + + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.path.html#splitpath">splitpath</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">path.basename(<span class="string">"/some/path/file.txt"</span>) <span class="comment">-- "file.txt" +</span>path.basename(<span class="string">"/some/path/file/"</span>) <span class="comment">-- "" (empty string)</span></pre> + </ul> + +</dd> + <dt> + <a name = "extension"></a> + <strong>extension (P)</strong> + </dt> + <dd> + get the extension part of a path. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + + + + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.path.html#splitext">splitext</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">path.extension(<span class="string">"/some/path/file.txt"</span>) <span class="comment">-- ".txt" +</span>path.extension(<span class="string">"/some/path/file_txt"</span>) <span class="comment">-- "" (empty string)</span></pre> + </ul> + +</dd> + <dt> + <a name = "isabs"></a> + <strong>isabs (P)</strong> + </dt> + <dd> + is this an absolute path? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">path.isabs(<span class="string">"hello/path"</span>) <span class="comment">-- false +</span>path.isabs(<span class="string">"/hello/path"</span>) <span class="comment">-- true +</span><span class="comment">-- Windows; +</span>path.isabs(<span class="string">"hello\path"</span>) <span class="comment">-- false +</span>path.isabs(<span class="string">"\hello\path"</span>) <span class="comment">-- true +</span>path.isabs(<span class="string">"C:\hello\path"</span>) <span class="comment">-- true +</span>path.isabs(<span class="string">"C:hello\path"</span>) <span class="comment">-- false</span></pre> + </ul> + +</dd> + <dt> + <a name = "join"></a> + <strong>join (p1, p2, ...)</strong> + </dt> + <dd> + return the path resulting from combining the individual paths. + if the second (or later) path is absolute, we return the last absolute path (joined with any non-absolute paths following). + empty elements (except the last) will be ignored. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">p1</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + <li><span class="parameter">p2</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + <li><span class="parameter">...</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + more file paths + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the combined path + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">path.join(<span class="string">"/first"</span>,<span class="string">"second"</span>,<span class="string">"third"</span>) <span class="comment">-- "/first/second/third" +</span>path.join(<span class="string">"first"</span>,<span class="string">"second/third"</span>) <span class="comment">-- "first/second/third" +</span>path.join(<span class="string">"/first"</span>,<span class="string">"/second"</span>,<span class="string">"third"</span>) <span class="comment">-- "/second/third"</span></pre> + </ul> + +</dd> + <dt> + <a name = "normcase"></a> + <strong>normcase (P)</strong> + </dt> + <dd> + +<p>normalize the case of a pathname. On Unix, this returns the path unchanged, + for Windows it converts;</p> + +<ul> + <li>the path to lowercase</li> + <li>forward slashes to backward slashes</li> +</ul> + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">path.normcase(<span class="string">"/Some/Path/File.txt"</span>) +<span class="comment">-- Windows: "\some\path\file.txt" +</span><span class="comment">-- Others : "/Some/Path/File.txt"</span></pre> + </ul> + +</dd> + <dt> + <a name = "normpath"></a> + <strong>normpath (P)</strong> + </dt> + <dd> + normalize a path name. + <code>A//B</code>, <code>A/./B</code>, and <code>A/foo/../B</code> all become <code>A/B</code>.</p> + +<p> An empty path results in '.'. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "relpath"></a> + <strong>relpath (P[, start])</strong> + </dt> + <dd> + relative path from current directory or optional start point + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a path + </li> + <li><span class="parameter">start</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + optional start point (default current directory) + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "expanduser"></a> + <strong>expanduser (P)</strong> + </dt> + <dd> + Replace a starting '~' with the user's home directory. + In windows, if HOME isn't set, then USERPROFILE is used in preference to + HOMEDRIVE HOMEPATH. This is guaranteed to be writeable on all versions of Windows. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">P</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + A file path + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "tmpname"></a> + <strong>tmpname ()</strong> + </dt> + <dd> + Return a suitable full path to a new temporary file name. + unlike os.tmpname(), it always gives you a writeable path (uses TEMP environment variable on Windows) + + + + + + + +</dd> + <dt> + <a name = "common_prefix"></a> + <strong>common_prefix (path1, path2)</strong> + </dt> + <dd> + return the largest common prefix path of two paths. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">path1</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a file path + </li> + <li><span class="parameter">path2</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the common prefix (Windows: separators will be normalized, casing will be original) + </ol> + + + + +</dd> + <dt> + <a name = "package_path"></a> + <strong>package_path (mod)</strong> + </dt> + <dd> + return the full path where a particular Lua module would be found. + Both package.path and package.cpath is searched, so the result may + either be a Lua file or a shared library. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">mod</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + name of the module + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + on success: path of module, lua or binary</li> + <li> + on error: nil, error string listing paths tried</li> + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Fields"></a>Fields</h2> + + <dl class="function"> + <dt> + <a name = "is_windows"></a> + <strong>is_windows</strong> + </dt> + <dd> + are we running Windows? + + + + + + + +</dd> + <dt> + <a name = "sep"></a> + <strong>sep</strong> + </dt> + <dd> + path separator for this platform. + + + + + + + +</dd> + <dt> + <a name = "dirsep"></a> + <strong>dirsep</strong> + </dt> + <dd> + separator for PATH for this platform + + + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.permute.html b/Data/Libraries/Penlight/docs/libraries/pl.permute.html new file mode 100644 index 0000000..afb887e --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.permute.html @@ -0,0 +1,354 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><strong>pl.permute</strong></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.permute</code></h1> +<p>Permutation operations.</p> +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.tablex.html#">pl.tablex</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#order_iter">order_iter (a)</a></td> + <td class="summary">an iterator over all order-permutations of the elements of a list.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#order_table">order_table (a)</a></td> + <td class="summary">construct a table containing all the order-permutations of a list.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#list_iter">list_iter (...)</a></td> + <td class="summary">an iterator over all permutations of the elements of the given lists.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#list_table">list_table (...)</a></td> + <td class="summary">construct a table containing all the permutations of a set of lists.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#iter">iter (...)</a></td> + <td class="summary">deprecated.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#table">table (...)</a></td> + <td class="summary">deprecated.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "order_iter"></a> + <strong>order_iter (a)</strong> + </dt> + <dd> + an iterator over all order-permutations of the elements of a list. + Please note that the same list is returned each time, so do not keep references! + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + list-like table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator which provides the next permutation as a list + </ol> + + + + +</dd> + <dt> + <a name = "order_table"></a> + <strong>order_table (a)</strong> + </dt> + <dd> + construct a table containing all the order-permutations of a list. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + list-like table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table of tables + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">permute.order_table {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>} <span class="comment">--> {{2,3,1},{3,2,1},{3,1,2},{1,3,2},{2,1,3},{1,2,3}}</span></pre> + </ul> + +</dd> + <dt> + <a name = "list_iter"></a> + <strong>list_iter (...)</strong> + </dt> + <dd> + an iterator over all permutations of the elements of the given lists. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + list-like tables, they are nil-safe if a length-field <code>n</code> is provided (see <a href="../libraries/pl.utils.html#pack">utils.pack</a>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator which provides the next permutation as return values in the same order as the provided lists, preceeded by an index + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> strs = utils.pack(<span class="string">"one"</span>, <span class="keyword">nil</span>, <span class="string">"three"</span>) <span class="comment">-- adds an 'n' field for nil-safety +</span><span class="keyword">local</span> bools = utils.pack(<span class="keyword">true</span>, <span class="keyword">false</span>) +<span class="keyword">local</span> iter = permute.list_iter(strs, bools) + +<span class="global">print</span>(iter()) <span class="comment">--> 1, one, true +</span><span class="global">print</span>(iter()) <span class="comment">--> 2, nil, true +</span><span class="global">print</span>(iter()) <span class="comment">--> 3, three, true +</span><span class="global">print</span>(iter()) <span class="comment">--> 4, one, false +</span><span class="global">print</span>(iter()) <span class="comment">--> 5, nil, false +</span><span class="global">print</span>(iter()) <span class="comment">--> 6, three, false</span></pre> + </ul> + +</dd> + <dt> + <a name = "list_table"></a> + <strong>list_table (...)</strong> + </dt> + <dd> + construct a table containing all the permutations of a set of lists. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + list-like tables, they are nil-safe if a length-field <code>n</code> is provided + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list of lists, the sub-lists have an 'n' field for nil-safety + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> strs = utils.pack(<span class="string">"one"</span>, <span class="keyword">nil</span>, <span class="string">"three"</span>) <span class="comment">-- adds an 'n' field for nil-safety +</span><span class="keyword">local</span> bools = utils.pack(<span class="keyword">true</span>, <span class="keyword">false</span>) +<span class="keyword">local</span> results = permute.list_table(strs, bools) +<span class="comment">-- results = { +</span><span class="comment">-- { "one, true, n = 2 } +</span><span class="comment">-- { nil, true, n = 2 }, +</span><span class="comment">-- { "three, true, n = 2 }, +</span><span class="comment">-- { "one, false, n = 2 }, +</span><span class="comment">-- { nil, false, n = 2 }, +</span><span class="comment">-- { "three", false, n = 2 }, +</span><span class="comment">-- }</span></pre> + </ul> + +</dd> + <dt> + <a name = "iter"></a> + <strong>iter (...)</strong> + </dt> + <dd> + deprecated. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + + + + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.permute.html#order_iter">permute.order_iter</a> + </ul> + + +</dd> + <dt> + <a name = "table"></a> + <strong>table (...)</strong> + </dt> + <dd> + deprecated. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + + + + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.permute.html#order_iter">permute.order_iter</a> + </ul> + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.pretty.html b/Data/Libraries/Penlight/docs/libraries/pl.pretty.html new file mode 100644 index 0000000..4561699 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.pretty.html @@ -0,0 +1,402 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><strong>pl.pretty</strong></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.pretty</code></h1> +<p>Pretty-printing Lua tables.</p> +<p> Also provides a sandboxed Lua table reader and + a function to present large numbers in human-friendly format.</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.lexer.html#">pl.lexer</a>, <a href="../libraries/pl.stringx.html#">pl.stringx</a>, <a href="../libraries/pl.pretty.html#debug">debug</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#read">read (s)</a></td> + <td class="summary">Read a string representation of a Lua table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#load">load (s[, env[, paranoid]])</a></td> + <td class="summary">Read a Lua chunk.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#write">write (tbl[, space[, not_clever]])</a></td> + <td class="summary">Create a string representation of a Lua table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dump">dump (t[, filename])</a></td> + <td class="summary">Dump a Lua table out to a file or stdout.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#debug">debug (...)</a></td> + <td class="summary">Dump a series of arguments to stdout for debug purposes.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#number">number (num[, kind[, prec]])</a></td> + <td class="summary">Format large numbers nicely for human consumption.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "read"></a> + <strong>read (s)</strong> + </dt> + <dd> + Read a string representation of a Lua table. + This function loads and runs the string as Lua code, but bails out + if it contains a function definition. + Loaded string is executed in an empty environment. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + string to read in <code>{...}</code> format, possibly with some whitespace + before or after the curly braces. A single line comment may be present + at the beginning. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table in case of success. + If loading the string failed, return <code>nil</code> and error message. + If executing loaded string failed, return <code>nil</code> and the error it raised. + </ol> + + + + +</dd> + <dt> + <a name = "load"></a> + <strong>load (s[, env[, paranoid]])</strong> + </dt> + <dd> + Read a Lua chunk. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + Lua code. + </li> + <li><span class="parameter">env</span> + <span class="types"><span class="type">tab</span></span> + environment used to run the code, empty by default. + (<em>optional</em>) + </li> + <li><span class="parameter">paranoid</span> + <span class="types"><span class="type">bool</span></span> + abort loading if any looping constructs a found in the code + and disable string methods. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the environment in case of success or <code>nil</code> and syntax or runtime error + if something went wrong. + </ol> + + + + +</dd> + <dt> + <a name = "write"></a> + <strong>write (tbl[, space[, not_clever]])</strong> + </dt> + <dd> + Create a string representation of a Lua table. + This function never fails, but may complain by returning an + extra value. Normally puts out one item per line, using + the provided indent; set the second parameter to an empty string + if you want output on one line.</p> + +<p> <em>NOTE:</em> this is NOT a serialization function, not a full blown + debug function. Checkout out respectively the + <a href="https://github.com/pkulchenko/serpent">serpent</a> + or <a href="https://github.com/kikito/inspect.lua">inspect</a> + Lua modules for that if you need them. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tbl</span> + <span class="types"><span class="type">tab</span></span> + Table to serialize to a string. + </li> + <li><span class="parameter">space</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + The indent to use. + Defaults to two spaces; pass an empty string for no indentation. + (<em>optional</em>) + </li> + <li><span class="parameter">not_clever</span> + <span class="types"><span class="type">bool</span></span> + Pass <code>true</code> for plain output, e.g <code>{['key']=1}</code>. + Defaults to <code>false</code>. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a string</li> + <li> + an optional error message</li> + </ol> + + + + +</dd> + <dt> + <a name = "dump"></a> + <strong>dump (t[, filename])</strong> + </dt> + <dd> + Dump a Lua table out to a file or stdout. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + The table to write to a file or stdout. + </li> + <li><span class="parameter">filename</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + File name to write too. Defaults to writing + to stdout. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "debug"></a> + <strong>debug (...)</strong> + </dt> + <dd> + Dump a series of arguments to stdout for debug purposes. + This function is attached to the module table <code>__call</code> method, to make it + extra easy to access. So the full:</p> + +<pre><code> print(require("pl.pretty").write({...})) +</code></pre> + +<p> Can be shortened to:</p> + +<pre><code> require"pl.pretty" (...) +</code></pre> + +<p> Any <code>nil</code> entries will be printed as <code>"<nil>"</code> to make them explicit. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + the parameters to dump to stdout. + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- example debug output +</span><span class="global">require</span><span class="string">"pl.pretty"</span> (<span class="string">"hello"</span>, <span class="keyword">nil</span>, <span class="string">"world"</span>, { bye = <span class="string">"world"</span>, <span class="keyword">true</span>} ) + +<span class="comment">-- output: +</span>{ + [<span class="string">"arg 1"</span>] = <span class="string">"hello"</span>, + [<span class="string">"arg 2"</span>] = <span class="string">"<nil>"</span>, + [<span class="string">"arg 3"</span>] = <span class="string">"world"</span>, + [<span class="string">"arg 4"</span>] = { + <span class="keyword">true</span>, + bye = <span class="string">"world"</span> + } +}</pre> + </ul> + +</dd> + <dt> + <a name = "number"></a> + <strong>number (num[, kind[, prec]])</strong> + </dt> + <dd> + Format large numbers nicely for human consumption. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">num</span> + <span class="types"><a class="type" href="../libraries/pl.pretty.html#number">number</a></span> + a number. + </li> + <li><span class="parameter">kind</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + one of <code>'M'</code> (memory in <code>KiB</code>, <code>MiB</code>, etc.), + <code>'N'</code> (postfixes are <code>'K'</code>, <code>'M'</code> and <code>'B'</code>), + or <code>'T'</code> (use commas as thousands separator), <code>'N'</code> by default. + (<em>optional</em>) + </li> + <li><span class="parameter">prec</span> + <span class="types"><span class="type">int</span></span> + number of digits to use for <code>'M'</code> and <code>'N'</code>, <code>1</code> by default. + (<em>optional</em>) + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.seq.html b/Data/Libraries/Penlight/docs/libraries/pl.seq.html new file mode 100644 index 0000000..e694581 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.seq.html @@ -0,0 +1,888 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><strong>pl.seq</strong></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.seq</code></h1> +<p>Manipulating iterators as sequences.</p> +<p> See <a href="../manual/07-functional.md.html#Sequences">The Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.types.html#">pl.types</a>, <a href="https://www.lua.org/manual/5.1/manual.html#5.9">debug</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#matching">matching (s)</a></td> + <td class="summary">given a string, return a function(y) which matches y against the string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#list">list (t)</a></td> + <td class="summary">sequence adaptor for a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#keys">keys (t)</a></td> + <td class="summary">return the keys of the table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#range">range (start, finish)</a></td> + <td class="summary">create an iterator over a numerical range.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#minmax">minmax (iter)</a></td> + <td class="summary">return the minimum and the maximum value of the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sum">sum (iter, fn)</a></td> + <td class="summary">return the sum and element count of the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copy">copy (iter)</a></td> + <td class="summary">create a table from the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copy2">copy2 (iter, i1, i2)</a></td> + <td class="summary">create a table of pairs from the double-valued sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copy_tuples">copy_tuples (iter)</a></td> + <td class="summary">create a table of 'tuples' from a multi-valued sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#random">random (n, l, u)</a></td> + <td class="summary">return an iterator of random numbers.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sort">sort (iter, comp)</a></td> + <td class="summary">return an iterator to the sorted elements of a sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#zip">zip (iter1, iter2)</a></td> + <td class="summary">return an iterator which returns elements of two sequences.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#count_map">count_map (iter)</a></td> + <td class="summary">Makes a table where the key/values are the values and value counts of the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#printall">printall (iter, sep, nfields, fmt)</a></td> + <td class="summary">print out a sequence iter with a separator.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map">map (fn, iter, arg)</a></td> + <td class="summary">return a sequence where every element of a sequence has been transformed + by a function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#filter">filter (iter, pred, arg)</a></td> + <td class="summary">filter a sequence using a predicate function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reduce">reduce (fn, iter, initval)</a></td> + <td class="summary">'reduce' a sequence using a binary function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#take">take (iter, n)</a></td> + <td class="summary">take the first n values from the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#skip">skip (iter, n)</a></td> + <td class="summary">skip the first n values of a sequence</td> + </tr> + <tr> + <td class="name" nowrap><a href="#enum">enum (iter)</a></td> + <td class="summary">a sequence with a sequence count and the original value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#mapmethod">mapmethod (iter, name, arg1, arg2)</a></td> + <td class="summary">map using a named method over a sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#last">last (iter)</a></td> + <td class="summary">a sequence of (last,current) values from another sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#foreach">foreach (iter, fn)</a></td> + <td class="summary">call the function on each element of the sequence.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#lines">lines (f, ...)</a></td> + <td class="summary">create a wrapped iterator over all lines in the file.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "matching"></a> + <strong>matching (s)</strong> + </dt> + <dd> + given a string, return a function(y) which matches y against the string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "list"></a> + <strong>list (t)</strong> + </dt> + <dd> + sequence adaptor for a table. Note that if any generic function is + passed a table, it will automatically use seq.list() + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + a list-like table + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">sum(list(t)) is the sum of all elements of t</pre></li> + <li><pre class="example"><span class="keyword">for</span> x <span class="keyword">in</span> list(t) <span class="keyword">do</span>...<span class="keyword">end</span></pre></li> + </ul> + +</dd> + <dt> + <a name = "keys"></a> + <strong>keys (t)</strong> + </dt> + <dd> + return the keys of the table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + an arbitrary table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + iterator over keys + </ol> + + + + +</dd> + <dt> + <a name = "range"></a> + <strong>range (start, finish)</strong> + </dt> + <dd> + create an iterator over a numerical range. Like the standard Python function xrange. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">start</span> + a number + </li> + <li><span class="parameter">finish</span> + a number greater than start + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "minmax"></a> + <strong>minmax (iter)</strong> + </dt> + <dd> + return the minimum and the maximum value of the sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + minimum value</li> + <li> + maximum value</li> + </ol> + + + + +</dd> + <dt> + <a name = "sum"></a> + <strong>sum (iter, fn)</strong> + </dt> + <dd> + return the sum and element count of the sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + <li><span class="parameter">fn</span> + an optional function to apply to the values + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "copy"></a> + <strong>copy (iter)</strong> + </dt> + <dd> + create a table from the sequence. (This will make the result a List.) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a List + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">copy(list(ls)) is equal to ls</pre></li> + <li><pre class="example">copy(list {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>}) == List{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "copy2"></a> + <strong>copy2 (iter, i1, i2)</strong> + </dt> + <dd> + create a table of pairs from the double-valued sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a double-valued sequence + </li> + <li><span class="parameter">i1</span> + used to capture extra iterator values + </li> + <li><span class="parameter">i2</span> + as with pairs & ipairs + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list-like table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">copy2(<span class="global">ipairs</span>{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>}) == {{<span class="number">1</span>,<span class="number">10</span>},{<span class="number">2</span>,<span class="number">20</span>},{<span class="number">3</span>,<span class="number">30</span>}}</pre> + </ul> + +</dd> + <dt> + <a name = "copy_tuples"></a> + <strong>copy_tuples (iter)</strong> + </dt> + <dd> + create a table of 'tuples' from a multi-valued sequence. + A generalization of copy2 above + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a multiple-valued sequence + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list-like table + </ol> + + + + +</dd> + <dt> + <a name = "random"></a> + <strong>random (n, l, u)</strong> + </dt> + <dd> + return an iterator of random numbers. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">n</span> + the length of the sequence + </li> + <li><span class="parameter">l</span> + same as the first optional argument to math.random + </li> + <li><span class="parameter">u</span> + same as the second optional argument to math.random + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a sequence + </ol> + + + + +</dd> + <dt> + <a name = "sort"></a> + <strong>sort (iter, comp)</strong> + </dt> + <dd> + return an iterator to the sorted elements of a sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + <li><span class="parameter">comp</span> + an optional comparison function (comp(x,y) is true if x < y) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "zip"></a> + <strong>zip (iter1, iter2)</strong> + </dt> + <dd> + return an iterator which returns elements of two sequences. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter1</span> + a sequence + </li> + <li><span class="parameter">iter2</span> + a sequence + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">for</span> x,y <span class="keyword">in</span> seq.zip(ls1,ls2) <span class="keyword">do</span>....<span class="keyword">end</span></pre> + </ul> + +</dd> + <dt> + <a name = "count_map"></a> + <strong>count_map (iter)</strong> + </dt> + <dd> + Makes a table where the key/values are the values and value counts of the sequence. + This version works with 'hashable' values like strings and numbers. + <a href="../libraries/pl.tablex.html#count_map">pl.tablex.count_map</a> is more general. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a map-like table</li> + <li> + a table</li> + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#count_map">pl.tablex.count_map</a> + </ul> + + +</dd> + <dt> + <a name = "printall"></a> + <strong>printall (iter, sep, nfields, fmt)</strong> + </dt> + <dd> + print out a sequence iter with a separator. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + <li><span class="parameter">sep</span> + the separator (default space) + </li> + <li><span class="parameter">nfields</span> + maximum number of values per line (default 7) + </li> + <li><span class="parameter">fmt</span> + optional format function for each value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "map"></a> + <strong>map (fn, iter, arg)</strong> + </dt> + <dd> + return a sequence where every element of a sequence has been transformed + by a function. If you don't supply an argument, then the function will + receive both values of a double-valued sequence, otherwise behaves rather like + tablex.map. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + a function to apply to elements; may take two arguments + </li> + <li><span class="parameter">iter</span> + a sequence of one or two values + </li> + <li><span class="parameter">arg</span> + optional argument to pass to function. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "filter"></a> + <strong>filter (iter, pred, arg)</strong> + </dt> + <dd> + filter a sequence using a predicate function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence of one or two values + </li> + <li><span class="parameter">pred</span> + a boolean function; may take two arguments + </li> + <li><span class="parameter">arg</span> + optional argument to pass to function. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "reduce"></a> + <strong>reduce (fn, iter, initval)</strong> + </dt> + <dd> + 'reduce' a sequence using a binary function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + <span class="types"><span class="type">func</span></span> + a function of two arguments + </li> + <li><span class="parameter">iter</span> + a sequence + </li> + <li><span class="parameter">initval</span> + optional initial value + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">seq.reduce(operator.add,seq.list{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>}) == <span class="number">10</span></pre></li> + <li><pre class="example">seq.reduce(<span class="string">'-'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>}) == -<span class="number">13</span></pre></li> + </ul> + +</dd> + <dt> + <a name = "take"></a> + <strong>take (iter, n)</strong> + </dt> + <dd> + take the first n values from the sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence of one or two values + </li> + <li><span class="parameter">n</span> + number of items to take + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a sequence of at most n items + </ol> + + + + +</dd> + <dt> + <a name = "skip"></a> + <strong>skip (iter, n)</strong> + </dt> + <dd> + skip the first n values of a sequence + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence of one or more values + </li> + <li><span class="parameter">n</span> + number of items to skip + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "enum"></a> + <strong>enum (iter)</strong> + </dt> + <dd> + a sequence with a sequence count and the original value. + enum(copy(ls)) is a roundabout way of saying ipairs(ls). + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a single or double valued sequence + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + sequence of (i,v), i = 1..n and v is from iter. + </ol> + + + + +</dd> + <dt> + <a name = "mapmethod"></a> + <strong>mapmethod (iter, name, arg1, arg2)</strong> + </dt> + <dd> + map using a named method over a sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + <li><span class="parameter">name</span> + the method name + </li> + <li><span class="parameter">arg1</span> + optional first extra argument + </li> + <li><span class="parameter">arg2</span> + optional second extra argument + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "last"></a> + <strong>last (iter)</strong> + </dt> + <dd> + a sequence of (last,current) values from another sequence. + This will return S(i-1),S(i) if given S(i) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "foreach"></a> + <strong>foreach (iter, fn)</strong> + </dt> + <dd> + call the function on each element of the sequence. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">iter</span> + a sequence with up to 3 values + </li> + <li><span class="parameter">fn</span> + a function + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "lines"></a> + <strong>lines (f, ...)</strong> + </dt> + <dd> + create a wrapped iterator over all lines in the file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + either a filename, file-like object, or 'STDIN' (for standard input) + </li> + <li><span class="parameter">...</span> + for Lua 5.2 only, optional format specifiers, as in <a href="https://www.lua.org/manual/5.1/manual.html#pdf-io.read">io.read</a>. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a sequence wrapper + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.sip.html b/Data/Libraries/Penlight/docs/libraries/pl.sip.html new file mode 100644 index 0000000..d488b09 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.sip.html @@ -0,0 +1,399 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><strong>pl.sip</strong></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.sip</code></h1> +<p>Simple Input Patterns (SIP).</p> +<p> SIP patterns start with '$', then a + one-letter type, and then an optional variable in curly braces.</p> + + +<pre> +sip.match(<span class="string">'$v=$q'</span>,<span class="string">'name="dolly"'</span>,res) +==> res=={<span class="string">'name'</span>,<span class="string">'dolly'</span>} +sip.match(<span class="string">'($q{first},$q{second})'</span>,<span class="string">'("john","smith")'</span>,res) +==> res=={second=<span class="string">'smith'</span>,first=<span class="string">'john'</span>} +</pre> + +<p> Type names:</p> + + +<pre> +v identifier +i integer +f floating-point +q quoted <span class="global">string</span> +([{< match up to closing bracket +</pre> + +<p> See <a href="../manual/08-additional.md.html#Simple_Input_Patterns">the Guide</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#create_pattern">create_pattern (spec, options)</a></td> + <td class="summary">convert a SIP pattern into the equivalent Lua string pattern.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compile">compile (spec, options)</a></td> + <td class="summary">convert a SIP pattern into a matching function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#match">match (spec, line, res, options)</a></td> + <td class="summary">match a SIP pattern against a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#match_at_start">match_at_start (spec, line, res)</a></td> + <td class="summary">match a SIP pattern against the start of a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#fields">fields (spec, f)</a></td> + <td class="summary">given a pattern and a file object, return an iterator over the results</td> + </tr> + <tr> + <td class="name" nowrap><a href="#pattern">pattern (spec, fun)</a></td> + <td class="summary">register a match which will be used in the read function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#read">read (f, matches)</a></td> + <td class="summary">enter a loop which applies all registered matches to the input file.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "create_pattern"></a> + <strong>create_pattern (spec, options)</strong> + </dt> + <dd> + convert a SIP pattern into the equivalent Lua string pattern. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + a SIP pattern + </li> + <li><span class="parameter">options</span> + a table; only the <code>at_start</code> field is + currently meaningful and ensures that the pattern is anchored + at the start of the string. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a Lua string pattern. + </ol> + + + + +</dd> + <dt> + <a name = "compile"></a> + <strong>compile (spec, options)</strong> + </dt> + <dd> + convert a SIP pattern into a matching function. + The returned function takes two arguments, the line and an empty table. + If the line matched the pattern, then this function returns true + and the table is filled with field-value pairs. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + a SIP pattern + </li> + <li><span class="parameter">options</span> + optional table; {at_start=true} ensures that the pattern + is anchored at the start of the string. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function if successful, or nil,error + </ol> + + + + +</dd> + <dt> + <a name = "match"></a> + <strong>match (spec, line, res, options)</strong> + </dt> + <dd> + match a SIP pattern against a string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + a SIP pattern + </li> + <li><span class="parameter">line</span> + a string + </li> + <li><span class="parameter">res</span> + a table to receive values + </li> + <li><span class="parameter">options</span> + (optional) option table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "match_at_start"></a> + <strong>match_at_start (spec, line, res)</strong> + </dt> + <dd> + match a SIP pattern against the start of a string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + a SIP pattern + </li> + <li><span class="parameter">line</span> + a string + </li> + <li><span class="parameter">res</span> + a table to receive values + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "fields"></a> + <strong>fields (spec, f)</strong> + </dt> + <dd> + given a pattern and a file object, return an iterator over the results + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + a SIP pattern + </li> + <li><span class="parameter">f</span> + a file-like object. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "pattern"></a> + <strong>pattern (spec, fun)</strong> + </dt> + <dd> + register a match which will be used in the read function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">spec</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a SIP pattern + </li> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function to be called with the results of the match + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.sip.html#read">read</a> + </ul> + + +</dd> + <dt> + <a name = "read"></a> + <strong>read (f, matches)</strong> + </dt> + <dd> + enter a loop which applies all registered matches to the input file. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + a file-like object + </li> + <li><span class="parameter">matches</span> + <span class="types"><span class="type">array</span></span> + optional list of <code>{spec,fun}</code> pairs, as for <a href="../libraries/pl.sip.html#pattern">pattern</a> above. + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.strict.html b/Data/Libraries/Penlight/docs/libraries/pl.strict.html new file mode 100644 index 0000000..3c9c0bd --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.strict.html @@ -0,0 +1,270 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><strong>pl.strict</strong></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.strict</code></h1> +<p>Checks uses of undeclared global variables.</p> +<p> All global variables must be 'declared' through a regular assignment + (even assigning <code>nil</code> will do) in a main chunk before being used + anywhere or assigned to inside a function. Existing metatables <code>__newindex</code> and <code>__index</code> + metamethods are respected.</p> + +<p> You can set any table to have strict behaviour using <a href="../libraries/pl.strict.html#module">strict.module</a>. Creating a new + module with <a href="../libraries/pl.strict.html#closed_module">strict.closed_module</a> makes the module immune to monkey-patching, if + you don't wish to encourage monkey business.</p> + +<p> If the global <code>PENLIGHT_NO_GLOBAL_STRICT</code> is defined, then this module won't make the + global environment strict - if you just want to explicitly set table strictness.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#module">module ([name[, mod[, predeclared]]])</a></td> + <td class="summary">make an existing table strict.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#make_all_strict">make_all_strict (T)</a></td> + <td class="summary">make all tables in a table strict.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#closed_module">closed_module (mod, name)</a></td> + <td class="summary">make a new module table which is closed to further changes.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "module"></a> + <strong>module ([name[, mod[, predeclared]]])</strong> + </dt> + <dd> + make an existing table strict. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + name of table + (<em>optional</em>) + </li> + <li><span class="parameter">mod</span> + <span class="types"><span class="type">tab</span></span> + the table to protect - if <code>nil</code> then we'll return a new table + (<em>optional</em>) + </li> + <li><span class="parameter">predeclared</span> + <span class="types"><span class="type">tab</span></span> + +<ul> + <li>table of variables that are to be considered predeclared.</li> +</ul> + + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the given table, or a new table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> M = { hello = <span class="string">"world"</span> } +strict.<span class="global">module</span> (<span class="string">"Awesome_Module"</span>, M, { + Lua = <span class="keyword">true</span>, <span class="comment">-- defines allowed keys +</span>}) + +<span class="global">assert</span>(M.hello == <span class="string">"world"</span>) +<span class="global">assert</span>(M.Lua == <span class="keyword">nil</span>) <span class="comment">-- access allowed, but has no value yet +</span>M.Lua = <span class="string">"Rocks"</span> +<span class="global">assert</span>(M.Lua == <span class="string">"Rocks"</span>) +M.not_allowed = <span class="string">"bad boy"</span> <span class="comment">-- throws an error</span></pre> + </ul> + +</dd> + <dt> + <a name = "make_all_strict"></a> + <strong>make_all_strict (T)</strong> + </dt> + <dd> + make all tables in a table strict. + So <code>strict.make_all_strict(_G)</code> prevents monkey-patching + of any global table + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">T</span> + <span class="types"><span class="type">tab</span></span> + the table containing the tables to protect. Table <code>T</code> itself will NOT be protected. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "closed_module"></a> + <strong>closed_module (mod, name)</strong> + </dt> + <dd> + make a new module table which is closed to further changes. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">mod</span> + <span class="types"><span class="type">tab</span></span> + module table + </li> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + module name + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.stringio.html b/Data/Libraries/Penlight/docs/libraries/pl.stringio.html new file mode 100644 index 0000000..7505d34 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.stringio.html @@ -0,0 +1,215 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><strong>pl.stringio</strong></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.stringio</code></h1> +<p>Reading and writing strings using file-like objects.</p> +<p> <br></p> + + +<pre> +f = stringio.open(text) +l1 = f:read() <span class="comment">-- read first line +</span>n,m = f:read (<span class="string">'*n'</span>,<span class="string">'*n'</span>) <span class="comment">-- read two numbers +</span><span class="keyword">for</span> line <span class="keyword">in</span> f:lines() <span class="keyword">do</span> <span class="global">print</span>(line) <span class="keyword">end</span> <span class="comment">-- iterate over all lines +</span>f = stringio.create() +f:write(<span class="string">'hello'</span>) +f:write(<span class="string">'dolly'</span>) +<span class="global">assert</span>(f:value(),<span class="string">'hellodolly'</span>) +</pre> + +<p> See <a href="../manual/03-strings.md.html#File_style_I_O_on_Strings">the Guide</a>.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#create">create ()</a></td> + <td class="summary">create a file-like object which can be used to construct a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#open">open (s)</a></td> + <td class="summary">create a file-like object for reading from a given string.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "create"></a> + <strong>create ()</strong> + </dt> + <dd> + create a file-like object which can be used to construct a string. + The resulting object has an extra <code>value()</code> method for + retrieving the string value. Implements <a href="../libraries/pl.file.html#write">file:write</a>, <code>file:seek</code>, <code>file:lines</code>, + plus an extra <code>writef</code> method which works like <a href="../libraries/pl.utils.html#printf">utils.printf</a>. + + + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">f = create(); f:write(<span class="string">'hello, dolly\n'</span>); <span class="global">print</span>(f:value())</pre> + </ul> + +</dd> + <dt> + <a name = "open"></a> + <strong>open (s)</strong> + </dt> + <dd> + create a file-like object for reading from a given string. + Implements <a href="../libraries/pl.file.html#read">file:read</a>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + The input string. + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">fs = open <span class="string">'20 10'</span>; x,y = f:read (<span class="string">'*n'</span>,<span class="string">'*n'</span>); <span class="global">assert</span>(x == <span class="number">20</span> <span class="keyword">and</span> y == <span class="number">10</span>)</pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.stringx.html b/Data/Libraries/Penlight/docs/libraries/pl.stringx.html new file mode 100644 index 0000000..4fd08cd --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.stringx.html @@ -0,0 +1,1239 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#String_Predicates">String Predicates </a></li> +<li><a href="#Strings_and_Lists">Strings and Lists </a></li> +<li><a href="#Finding_and_Replacing">Finding and Replacing </a></li> +<li><a href="#Stripping_and_Justifying">Stripping and Justifying </a></li> +<li><a href="#Partioning_Strings">Partioning Strings </a></li> +<li><a href="#Miscelaneous">Miscelaneous </a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><strong>pl.stringx</strong></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.stringx</code></h1> +<p>Python-style extended string library.</p> +<p> see 3.6.1 of the Python reference. + If you want to make these available as string methods, then say + <code>stringx.import()</code> to bring them into the standard <a href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> table.</p> + +<p> See <a href="../manual/03-strings.md.html#">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a></p> + + +<h2><a href="#String_Predicates">String Predicates </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#isalpha">isalpha (s)</a></td> + <td class="summary">does s only contain alphabetic characters?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isdigit">isdigit (s)</a></td> + <td class="summary">does s only contain digits?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isalnum">isalnum (s)</a></td> + <td class="summary">does s only contain alphanumeric characters?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isspace">isspace (s)</a></td> + <td class="summary">does s only contain spaces?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#islower">islower (s)</a></td> + <td class="summary">does s only contain lower case characters?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#isupper">isupper (s)</a></td> + <td class="summary">does s only contain upper case characters?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#startswith">startswith (s, prefix)</a></td> + <td class="summary">does s start with prefix or one of prefixes?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#endswith">endswith (s, suffix)</a></td> + <td class="summary">does s end with suffix or one of suffixes?</td> + </tr> +</table> +<h2><a href="#Strings_and_Lists">Strings and Lists </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#join">join (s, seq)</a></td> + <td class="summary">concatenate the strings using this string as a delimiter.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#splitlines">splitlines (s[, keep_ends])</a></td> + <td class="summary">Split a string into a list of lines.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#split">split (s[, re[, n]])</a></td> + <td class="summary">split a string into a list of strings using a delimiter.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#expandtabs">expandtabs (s, tabsize)</a></td> + <td class="summary">replace all tabs in s with tabsize spaces.</td> + </tr> +</table> +<h2><a href="#Finding_and_Replacing">Finding and Replacing </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#lfind">lfind (s, sub[, first[, last]])</a></td> + <td class="summary">find index of first instance of sub in s from the left.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rfind">rfind (s, sub[, first[, last]])</a></td> + <td class="summary">find index of first instance of sub in s from the right.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#replace">replace (s, old, new[, n])</a></td> + <td class="summary">replace up to n instances of old by new in the string s.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#count">count (s, sub[, allow_overlap])</a></td> + <td class="summary">count all instances of substring in string.</td> + </tr> +</table> +<h2><a href="#Stripping_and_Justifying">Stripping and Justifying </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#ljust">ljust (s, w[, ch=' '])</a></td> + <td class="summary">left-justify s with width w.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rjust">rjust (s, w[, ch=' '])</a></td> + <td class="summary">right-justify s with width w.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#center">center (s, w[, ch=' '])</a></td> + <td class="summary">center-justify s with width w.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#lstrip">lstrip (s[, chrs='%s'])</a></td> + <td class="summary">trim any whitespace on the left of s.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rstrip">rstrip (s[, chrs='%s'])</a></td> + <td class="summary">trim any whitespace on the right of s.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#strip">strip (s[, chrs='%s'])</a></td> + <td class="summary">trim any whitespace on both left and right of s.</td> + </tr> +</table> +<h2><a href="#Partioning_Strings">Partioning Strings </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#splitv">splitv (s[, re='%s'])</a></td> + <td class="summary">split a string using a pattern.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#partition">partition (s, ch)</a></td> + <td class="summary">partition the string using first occurance of a delimiter</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rpartition">rpartition (s, ch)</a></td> + <td class="summary">partition the string p using last occurance of a delimiter</td> + </tr> + <tr> + <td class="name" nowrap><a href="#at">at (s, idx)</a></td> + <td class="summary">return the 'character' at the index.</td> + </tr> +</table> +<h2><a href="#Miscelaneous">Miscelaneous </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#lines">lines (s)</a></td> + <td class="summary">return an iterator over all lines in a string</td> + </tr> + <tr> + <td class="name" nowrap><a href="#title">title (s)</a></td> + <td class="summary">inital word letters uppercase ('title case').</td> + </tr> + <tr> + <td class="name" nowrap><a href="#shorten">shorten (s, w, tail)</a></td> + <td class="summary">Return a shortened version of a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#quote_string">quote_string (s)</a></td> + <td class="summary">Quote the given string and preserve any control or escape characters, such that reloading the string in Lua returns the same result.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="String_Predicates"></a>String Predicates </h2> + + <dl class="function"> + <dt> + <a name = "isalpha"></a> + <strong>isalpha (s)</strong> + </dt> + <dd> + does s only contain alphabetic characters? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "isdigit"></a> + <strong>isdigit (s)</strong> + </dt> + <dd> + does s only contain digits? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "isalnum"></a> + <strong>isalnum (s)</strong> + </dt> + <dd> + does s only contain alphanumeric characters? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "isspace"></a> + <strong>isspace (s)</strong> + </dt> + <dd> + does s only contain spaces? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "islower"></a> + <strong>islower (s)</strong> + </dt> + <dd> + does s only contain lower case characters? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "isupper"></a> + <strong>isupper (s)</strong> + </dt> + <dd> + does s only contain upper case characters? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "startswith"></a> + <strong>startswith (s, prefix)</strong> + </dt> + <dd> + does s start with prefix or one of prefixes? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + <li><span class="parameter">prefix</span> + a string or an array of strings + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "endswith"></a> + <strong>endswith (s, suffix)</strong> + </dt> + <dd> + does s end with suffix or one of suffixes? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a string + </li> + <li><span class="parameter">suffix</span> + a string or an array of strings + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Strings_and_Lists"></a>Strings and Lists </h2> + + <dl class="function"> + <dt> + <a name = "join"></a> + <strong>join (s, seq)</strong> + </dt> + <dd> + concatenate the strings using this string as a delimiter. + Note that the arguments are reversed from <code>string.concat</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">seq</span> + a table of strings or numbers + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">stringx.join(<span class="string">' '</span>, {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>}) == <span class="string">'1 2 3'</span></pre> + </ul> + +</dd> + <dt> + <a name = "splitlines"></a> + <strong>splitlines (s[, keep_ends])</strong> + </dt> + <dd> + Split a string into a list of lines. + <code>"\r"</code>, <code>"\n"</code>, and <code>"\r\n"</code> are considered line ends. + They are not included in the lines unless <code>keepends</code> is passed. + Terminal line end does not produce an extra line. + Splitting an empty string results in an empty list. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string. + </li> + <li><span class="parameter">keep_ends</span> + <span class="types"><span class="type">bool</span></span> + include line ends. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + List of lines + </ol> + + + + +</dd> + <dt> + <a name = "split"></a> + <strong>split (s[, re[, n]])</strong> + </dt> + <dd> + split a string into a list of strings using a delimiter. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">re</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a delimiter (defaults to whitespace) + (<em>optional</em>) + </li> + <li><span class="parameter">n</span> + <span class="types"><span class="type">int</span></span> + maximum number of results + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + List + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">#(stringx.split(<span class="string">'one two'</span>)) == <span class="number">2</span></pre></li> + <li><pre class="example">stringx.split(<span class="string">'one,two,three'</span>, <span class="string">','</span>) == List{<span class="string">'one'</span>,<span class="string">'two'</span>,<span class="string">'three'</span>}</pre></li> + <li><pre class="example">stringx.split(<span class="string">'one,two,three'</span>, <span class="string">','</span>, <span class="number">2</span>) == List{<span class="string">'one'</span>,<span class="string">'two,three'</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "expandtabs"></a> + <strong>expandtabs (s, tabsize)</strong> + </dt> + <dd> + replace all tabs in s with tabsize spaces. If not specified, tabsize defaults to 8. + Tab stops will be honored. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">tabsize</span> + <span class="types"><span class="type">int</span></span> + [opt=8] number of spaces to expand each tab + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + expanded string + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">stringx.expandtabs(<span class="string">'\tone,two,three'</span>, <span class="number">4</span>) == <span class="string">' one,two,three'</span></pre></li> + <li><pre class="example">stringx.expandtabs(<span class="string">' \tone,two,three'</span>, <span class="number">4</span>) == <span class="string">' one,two,three'</span></pre></li> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Finding_and_Replacing"></a>Finding and Replacing </h2> + + <dl class="function"> + <dt> + <a name = "lfind"></a> + <strong>lfind (s, sub[, first[, last]])</strong> + </dt> + <dd> + find index of first instance of sub in s from the left. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">sub</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + substring + </li> + <li><span class="parameter">first</span> + <span class="types"><span class="type">int</span></span> + first index + (<em>optional</em>) + </li> + <li><span class="parameter">last</span> + <span class="types"><span class="type">int</span></span> + last index + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + start index, or nil if not found + </ol> + + + + +</dd> + <dt> + <a name = "rfind"></a> + <strong>rfind (s, sub[, first[, last]])</strong> + </dt> + <dd> + find index of first instance of sub in s from the right. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">sub</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + substring + </li> + <li><span class="parameter">first</span> + <span class="types"><span class="type">int</span></span> + first index + (<em>optional</em>) + </li> + <li><span class="parameter">last</span> + <span class="types"><span class="type">int</span></span> + last index + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + start index, or nil if not found + </ol> + + + + +</dd> + <dt> + <a name = "replace"></a> + <strong>replace (s, old, new[, n])</strong> + </dt> + <dd> + replace up to n instances of old by new in the string s. + If n is not present, replace all instances. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">old</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the target substring + </li> + <li><span class="parameter">new</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the substitution + </li> + <li><span class="parameter">n</span> + <span class="types"><span class="type">int</span></span> + optional maximum number of substitutions + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + result string + </ol> + + + + +</dd> + <dt> + <a name = "count"></a> + <strong>count (s, sub[, allow_overlap])</strong> + </dt> + <dd> + count all instances of substring in string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">sub</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + substring + </li> + <li><span class="parameter">allow_overlap</span> + <span class="types"><span class="type">bool</span></span> + allow matches to overlap + (<em>optional</em>) + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="global">assert</span>(stringx.count(<span class="string">'banana'</span>, <span class="string">'ana'</span>) == <span class="number">1</span>) +<span class="global">assert</span>(stringx.count(<span class="string">'banana'</span>, <span class="string">'ana'</span>, <span class="keyword">true</span>) == <span class="number">2</span>)</pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Stripping_and_Justifying"></a>Stripping and Justifying </h2> + + <dl class="function"> + <dt> + <a name = "ljust"></a> + <strong>ljust (s, w[, ch=' '])</strong> + </dt> + <dd> + left-justify s with width w. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">w</span> + <span class="types"><span class="type">int</span></span> + width of justification + </li> + <li><span class="parameter">ch</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + padding character + (<em>default</em> ' ') + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">stringx.ljust(<span class="string">'hello'</span>, <span class="number">10</span>, <span class="string">'*'</span>) == <span class="string">'*****hello'</span></pre> + </ul> + +</dd> + <dt> + <a name = "rjust"></a> + <strong>rjust (s, w[, ch=' '])</strong> + </dt> + <dd> + right-justify s with width w. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">w</span> + <span class="types"><span class="type">int</span></span> + width of justification + </li> + <li><span class="parameter">ch</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + padding character + (<em>default</em> ' ') + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">stringx.rjust(<span class="string">'hello'</span>, <span class="number">10</span>, <span class="string">'*'</span>) == <span class="string">'hello*****'</span></pre> + </ul> + +</dd> + <dt> + <a name = "center"></a> + <strong>center (s, w[, ch=' '])</strong> + </dt> + <dd> + center-justify s with width w. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">w</span> + <span class="types"><span class="type">int</span></span> + width of justification + </li> + <li><span class="parameter">ch</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + padding character + (<em>default</em> ' ') + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">stringx.center(<span class="string">'hello'</span>, <span class="number">10</span>, <span class="string">'*'</span>) == <span class="string">'**hello***'</span></pre> + </ul> + +</dd> + <dt> + <a name = "lstrip"></a> + <strong>lstrip (s[, chrs='%s'])</strong> + </dt> + <dd> + trim any whitespace on the left of s. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">chrs</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + default any whitespace character, + but can be a string of characters to be trimmed + (<em>default</em> '%s') + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "rstrip"></a> + <strong>rstrip (s[, chrs='%s'])</strong> + </dt> + <dd> + trim any whitespace on the right of s. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">chrs</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + default any whitespace character, + but can be a string of characters to be trimmed + (<em>default</em> '%s') + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "strip"></a> + <strong>strip (s[, chrs='%s'])</strong> + </dt> + <dd> + trim any whitespace on both left and right of s. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">chrs</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + default any whitespace character, + but can be a string of characters to be trimmed + (<em>default</em> '%s') + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Partioning_Strings"></a>Partioning Strings </h2> + + <dl class="function"> + <dt> + <a name = "splitv"></a> + <strong>splitv (s[, re='%s'])</strong> + </dt> + <dd> + split a string using a pattern. Note that at least one value will be returned! + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">re</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a Lua string pattern (defaults to whitespace) + (<em>default</em> '%s') + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the parts of the string + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#splitv">utils.splitv</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">a,b = line:splitv(<span class="string">'='</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "partition"></a> + <strong>partition (s, ch)</strong> + </dt> + <dd> + partition the string using first occurance of a delimiter + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">ch</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + delimiter + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + part before ch</li> + <li> + ch</li> + <li> + part after ch</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">{stringx.partition(<span class="string">'a,b,c'</span>, <span class="string">','</span>))} == {<span class="string">'a'</span>, <span class="string">','</span>, <span class="string">'b,c'</span>}</pre></li> + <li><pre class="example">{stringx.partition(<span class="string">'abc'</span>, <span class="string">'x'</span>))} == {<span class="string">'abc'</span>, <span class="string">''</span>, <span class="string">''</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "rpartition"></a> + <strong>rpartition (s, ch)</strong> + </dt> + <dd> + partition the string p using last occurance of a delimiter + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">ch</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + delimiter + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + part before ch</li> + <li> + ch</li> + <li> + part after ch</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">{stringx.rpartition(<span class="string">'a,b,c'</span>, <span class="string">','</span>))} == {<span class="string">'a,b'</span>, <span class="string">','</span>, <span class="string">'c'</span>}</pre></li> + <li><pre class="example">{stringx.rpartition(<span class="string">'abc'</span>, <span class="string">'x'</span>))} == {<span class="string">''</span>, <span class="string">''</span>, <span class="string">'abc'</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "at"></a> + <strong>at (s, idx)</strong> + </dt> + <dd> + return the 'character' at the index. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">idx</span> + <span class="types"><span class="type">int</span></span> + an index (can be negative) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a substring of length 1 if successful, empty string otherwise. + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Miscelaneous"></a>Miscelaneous </h2> + + <dl class="function"> + <dt> + <a name = "lines"></a> + <strong>lines (s)</strong> + </dt> + <dd> + return an iterator over all lines in a string + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> line_no = <span class="number">1</span> +<span class="keyword">for</span> line <span class="keyword">in</span> stringx.lines(some_text) <span class="keyword">do</span> + <span class="global">print</span>(line_no, line) + line_no = line_no + <span class="number">1</span> +<span class="keyword">end</span></pre> + </ul> + +</dd> + <dt> + <a name = "title"></a> + <strong>title (s)</strong> + </dt> + <dd> + inital word letters uppercase ('title case'). + Here 'words' mean chunks of non-space characters. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string with each word's first letter uppercase + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">stringx.title(<span class="string">"hello world"</span>) == <span class="string">"Hello World"</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "shorten"></a> + <strong>shorten (s, w, tail)</strong> + </dt> + <dd> + Return a shortened version of a string. + Fits string within w characters. Removed characters are marked with ellipsis. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">w</span> + <span class="types"><span class="type">int</span></span> + the maxinum size allowed + </li> + <li><span class="parameter">tail</span> + <span class="types"><span class="type">bool</span></span> + true if we want to show the end of the string (head otherwise) + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">(<span class="string">'1234567890'</span>):shorten(<span class="number">8</span>) == <span class="string">'12345...'</span></pre></li> + <li><pre class="example">(<span class="string">'1234567890'</span>):shorten(<span class="number">8</span>, <span class="keyword">true</span>) == <span class="string">'...67890'</span></pre></li> + <li><pre class="example">(<span class="string">'1234567890'</span>):shorten(<span class="number">20</span>) == <span class="string">'1234567890'</span></pre></li> + </ul> + +</dd> + <dt> + <a name = "quote_string"></a> + <strong>quote_string (s)</strong> + </dt> + <dd> + Quote the given string and preserve any control or escape characters, such that reloading the string in Lua returns the same result. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + The string to be quoted. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + The quoted string. + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.tablex.html b/Data/Libraries/Penlight/docs/libraries/pl.tablex.html new file mode 100644 index 0000000..2e07080 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.tablex.html @@ -0,0 +1,1980 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Copying">Copying</a></li> +<li><a href="#Comparing">Comparing</a></li> +<li><a href="#Finding">Finding</a></li> +<li><a href="#MappingAndFiltering">MappingAndFiltering</a></li> +<li><a href="#Iterating">Iterating</a></li> +<li><a href="#Extraction">Extraction</a></li> +<li><a href="#Merging">Merging</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><strong>pl.tablex</strong></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.tablex</code></h1> +<p>Extended operations on Lua tables.</p> +<p> See <a href="../manual/02-arrays.md.html#Useful_Operations_on_Tables">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.types.html#">pl.types</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#size">size (t)</a></td> + <td class="summary">total number of elements in this table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#index_by">index_by (tbl, idx)</a></td> + <td class="summary">return a list of all values in a table indexed by another list.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#transform">transform (fun, t, ...)</a></td> + <td class="summary">apply a function to all values of a table, in-place.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#range">range (start, finish[, step=1])</a></td> + <td class="summary">generate a table of all numbers in a range.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#reduce">reduce (fun, t, memo)</a></td> + <td class="summary">'reduce' a list using a binary function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#index_map">index_map (t)</a></td> + <td class="summary">create an index map from a list-like table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#makeset">makeset (t)</a></td> + <td class="summary">create a set from a list-like table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#union">union (t1, t2)</a></td> + <td class="summary">the union of two map-like tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#intersection">intersection (t1, t2)</a></td> + <td class="summary">the intersection of two map-like tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#count_map">count_map (t, cmp)</a></td> + <td class="summary">A table where the key/values are the values and value counts of the table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#set">set (t, val[, i1=1[, i2=#t]])</a></td> + <td class="summary">set an array range to a value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#new">new (n, val)</a></td> + <td class="summary">create a new array of specified size with initial value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#clear">clear (t, istart)</a></td> + <td class="summary">clear out the contents of a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#removevalues">removevalues (t, i1, i2)</a></td> + <td class="summary">remove a range of values from a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#readonly">readonly (t)</a></td> + <td class="summary">modifies a table to be read only.</td> + </tr> +</table> +<h2><a href="#Copying">Copying</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#update">update (t1, t2)</a></td> + <td class="summary">copy a table into another, in-place.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#copy">copy (t)</a></td> + <td class="summary">make a shallow copy of a table</td> + </tr> + <tr> + <td class="name" nowrap><a href="#deepcopy">deepcopy (t)</a></td> + <td class="summary">make a deep copy of a table, recursively copying all the keys and fields.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#icopy">icopy (dest, src[, idest=1[, isrc=1[, nsrc=#src]]])</a></td> + <td class="summary">copy an array into another one, clearing <code>dest</code> after <code>idest+nsrc</code>, if necessary.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#move">move (dest, src[, idest=1[, isrc=1[, nsrc=#src]]])</a></td> + <td class="summary">copy an array into another one.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#insertvalues">insertvalues (t[, position], values)</a></td> + <td class="summary">insert values into a table.</td> + </tr> +</table> +<h2><a href="#Comparing">Comparing</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#deepcompare">deepcompare (t1, t2[, ignore_mt[, eps]])</a></td> + <td class="summary">compare two values.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compare">compare (t1, t2, cmp)</a></td> + <td class="summary">compare two arrays using a predicate.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compare_no_order">compare_no_order (t1, t2, cmp)</a></td> + <td class="summary">compare two list-like tables using an optional predicate, without regard for element order.</td> + </tr> +</table> +<h2><a href="#Finding">Finding</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#find">find (t, val, idx)</a></td> + <td class="summary">return the index of a value in a list.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#rfind">rfind (t, val, idx)</a></td> + <td class="summary">return the index of a value in a list, searching from the end.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#find_if">find_if (t, cmp, arg)</a></td> + <td class="summary">return the index (or key) of a value in a table using a comparison function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#search">search (t, value[, exclude])</a></td> + <td class="summary">find a value in a table by recursive search.</td> + </tr> +</table> +<h2><a href="#MappingAndFiltering">MappingAndFiltering</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#map">map (fun, t, ...)</a></td> + <td class="summary">apply a function to all values of a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#imap">imap (fun, t, ...)</a></td> + <td class="summary">apply a function to all values of a list.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map_named_method">map_named_method (name, t, ...)</a></td> + <td class="summary">apply a named method to values from a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#map2">map2 (fun, t1, t2, ...)</a></td> + <td class="summary">apply a function to values from two tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#imap2">imap2 (fun, t1, t2, ...)</a></td> + <td class="summary">apply a function to values from two arrays.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#mapn">mapn (fun, ..., fun)</a></td> + <td class="summary">Apply a function to a number of tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#pairmap">pairmap (fun, t, ...)</a></td> + <td class="summary">call the function with the key and value pairs from a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#filter">filter (t, pred, arg)</a></td> + <td class="summary">filter an array's values using a predicate function</td> + </tr> +</table> +<h2><a href="#Iterating">Iterating</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#foreach">foreach (t, fun, ...)</a></td> + <td class="summary">apply a function to all elements of a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#foreachi">foreachi (t, fun, ...)</a></td> + <td class="summary">apply a function to all elements of a list-like table in order.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sort">sort (t, f)</a></td> + <td class="summary">return an iterator to a table sorted by its keys</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sortv">sortv (t, f)</a></td> + <td class="summary">return an iterator to a table sorted by its values</td> + </tr> +</table> +<h2><a href="#Extraction">Extraction</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#keys">keys (t)</a></td> + <td class="summary">return all the keys of a table in arbitrary order.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#values">values (t)</a></td> + <td class="summary">return all the values of the table in arbitrary order</td> + </tr> + <tr> + <td class="name" nowrap><a href="#sub">sub (t, first, last)</a></td> + <td class="summary">Extract a range from a table, like 'string.sub'.</td> + </tr> +</table> +<h2><a href="#Merging">Merging</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#merge">merge (t1, t2, dup)</a></td> + <td class="summary">combine two tables, either as union or intersection.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#difference">difference (s1, s2, symm)</a></td> + <td class="summary">a new table which is the difference of two tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#zip">zip (...)</a></td> + <td class="summary">return a table where each element is a table of the ith values of an arbitrary + number of tables.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "size"></a> + <strong>size (t)</strong> + </dt> + <dd> + total number of elements in this table. + Note that this is distinct from <code>#t</code>, which is the number + of values in the array part; this value will always + be greater or equal. The difference gives the size of + the hash part, for practical purposes. Works for any + object with a __pairs metamethod. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the size + </ol> + + + + +</dd> + <dt> + <a name = "index_by"></a> + <strong>index_by (tbl, idx)</strong> + </dt> + <dd> + return a list of all values in a table indexed by another list. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tbl</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">idx</span> + <span class="types"><span class="type">array</span></span> + an index table (a list of keys) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list-like table + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">index_by({<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>,<span class="number">40</span>},{<span class="number">2</span>,<span class="number">4</span>}) == {<span class="number">20</span>,<span class="number">40</span>}</pre></li> + <li><pre class="example">index_by({one=<span class="number">1</span>,two=<span class="number">2</span>,three=<span class="number">3</span>},{<span class="string">'one'</span>,<span class="string">'three'</span>}) == {<span class="number">1</span>,<span class="number">3</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "transform"></a> + <strong>transform (fun, t, ...)</strong> + </dt> + <dd> + apply a function to all values of a table, in-place. + Any extra arguments are passed to the function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + A function that takes at least one argument + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">...</span> + extra arguments passed to <code>fun</code> + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#foreach">tablex.foreach</a> + </ul> + + +</dd> + <dt> + <a name = "range"></a> + <strong>range (start, finish[, step=1])</strong> + </dt> + <dd> + generate a table of all numbers in a range. + This is consistent with a numerical for loop. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">start</span> + <span class="types"><span class="type">int</span></span> + number + </li> + <li><span class="parameter">finish</span> + <span class="types"><span class="type">int</span></span> + number + </li> + <li><span class="parameter">step</span> + <span class="types"><span class="type">int</span></span> + make this negative for start < finish + (<em>default</em> 1) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "reduce"></a> + <strong>reduce (fun, t, memo)</strong> + </dt> + <dd> + 'reduce' a list using a binary function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function of two arguments + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">memo</span> + <span class="types"><span class="type">array</span></span> + optional initial memo value. Defaults to first value in table. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the result of the function + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">reduce(<span class="string">'+'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>}) == <span class="number">10</span></pre> + </ul> + +</dd> + <dt> + <a name = "index_map"></a> + <strong>index_map (t)</strong> + </dt> + <dd> + create an index map from a list-like table. The original values become keys, + and the associated values are the indices into the original list. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a map-like table + </ol> + + + + +</dd> + <dt> + <a name = "makeset"></a> + <strong>makeset (t)</strong> + </dt> + <dd> + create a set from a list-like table. A set is a table where the original values + become keys, and the associated values are all true. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a set (a map-like table) + </ol> + + + + +</dd> + <dt> + <a name = "union"></a> + <strong>union (t1, t2)</strong> + </dt> + <dd> + the union of two map-like tables. + If there are duplicate keys, the second table wins. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">tab</span></span> + + + + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#merge">tablex.merge</a> + </ul> + + +</dd> + <dt> + <a name = "intersection"></a> + <strong>intersection (t1, t2)</strong> + </dt> + <dd> + the intersection of two map-like tables. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <span class="types"><span class="type">tab</span></span> + + + + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#merge">tablex.merge</a> + </ul> + + +</dd> + <dt> + <a name = "count_map"></a> + <strong>count_map (t, cmp)</strong> + </dt> + <dd> + A table where the key/values are the values and value counts of the table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">cmp</span> + <span class="types"><span class="type">func</span></span> + a function that defines equality (otherwise uses ==) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a map-like table + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.seq.html#count_map">seq.count_map</a> + </ul> + + +</dd> + <dt> + <a name = "set"></a> + <strong>set (t, val[, i1=1[, i2=#t]])</strong> + </dt> + <dd> + set an array range to a value. If it's a function we use the result + of applying it to the indices. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">val</span> + a value + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start range + (<em>default</em> 1) + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end range + (<em>default</em> #t) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "new"></a> + <strong>new (n, val)</strong> + </dt> + <dd> + create a new array of specified size with initial value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">n</span> + <span class="types"><span class="type">int</span></span> + size + </li> + <li><span class="parameter">val</span> + initial value (can be <code>nil</code>, but don't expect <code>#</code> to work!) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the table + </ol> + + + + +</dd> + <dt> + <a name = "clear"></a> + <strong>clear (t, istart)</strong> + </dt> + <dd> + clear out the contents of a table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list + </li> + <li><span class="parameter">istart</span> + optional start position + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "removevalues"></a> + <strong>removevalues (t, i1, i2)</strong> + </dt> + <dd> + remove a range of values from a table. + End of range may be negative. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">i1</span> + <span class="types"><span class="type">int</span></span> + start index + </li> + <li><span class="parameter">i2</span> + <span class="types"><span class="type">int</span></span> + end index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the table + </ol> + + + + +</dd> + <dt> + <a name = "readonly"></a> + <strong>readonly (t)</strong> + </dt> + <dd> + modifies a table to be read only. + This only offers weak protection. Tables can still be modified with + <a href="https://www.lua.org/manual/5.1/manual.html#pdf-table.insert">table.insert</a> and <a href="https://www.lua.org/manual/5.1/manual.html#pdf-rawset">rawset</a>.</p> + +<p> <em>NOTE</em>: for Lua 5.1 length, pairs and ipairs will not work, since the + equivalent metamethods are only available in Lua 5.2 and newer. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + the table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the table read only (a proxy). + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Copying"></a>Copying</h2> + + <dl class="function"> + <dt> + <a name = "update"></a> + <strong>update (t1, t2)</strong> + </dt> + <dd> + copy a table into another, in-place. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">tab</span></span> + destination table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">tab</span></span> + source (actually any iterable object) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + first table + </ol> + + + + +</dd> + <dt> + <a name = "copy"></a> + <strong>copy (t)</strong> + </dt> + <dd> + make a shallow copy of a table + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + an iterable source + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + new table + </ol> + + + + +</dd> + <dt> + <a name = "deepcopy"></a> + <strong>deepcopy (t)</strong> + </dt> + <dd> + make a deep copy of a table, recursively copying all the keys and fields. + This supports cycles in tables; cycles will be reproduced in the copy. + This will also set the copied table's metatable to that of the original. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + new table + </ol> + + + + +</dd> + <dt> + <a name = "icopy"></a> + <strong>icopy (dest, src[, idest=1[, isrc=1[, nsrc=#src]]])</strong> + </dt> + <dd> + copy an array into another one, clearing <code>dest</code> after <code>idest+nsrc</code>, if necessary. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dest</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">src</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">idest</span> + <span class="types"><span class="type">int</span></span> + where to start copying values into destination + (<em>default</em> 1) + </li> + <li><span class="parameter">isrc</span> + <span class="types"><span class="type">int</span></span> + where to start copying values from source + (<em>default</em> 1) + </li> + <li><span class="parameter">nsrc</span> + <span class="types"><span class="type">int</span></span> + number of elements to copy from source + (<em>default</em> #src) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "move"></a> + <strong>move (dest, src[, idest=1[, isrc=1[, nsrc=#src]]])</strong> + </dt> + <dd> + copy an array into another one. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">dest</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">src</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">idest</span> + <span class="types"><span class="type">int</span></span> + where to start copying values into destination + (<em>default</em> 1) + </li> + <li><span class="parameter">isrc</span> + <span class="types"><span class="type">int</span></span> + where to start copying values from source + (<em>default</em> 1) + </li> + <li><span class="parameter">nsrc</span> + <span class="types"><span class="type">int</span></span> + number of elements to copy from source + (<em>default</em> #src) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "insertvalues"></a> + <strong>insertvalues (t[, position], values)</strong> + </dt> + <dd> + insert values into a table. + similar to <a href="https://www.lua.org/manual/5.1/manual.html#pdf-table.insert">table.insert</a> but inserts values from given table <a href="../libraries/pl.tablex.html#values">values</a>, + not the object itself, into table <code>t</code> at position <code>pos</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + the list + </li> + <li><span class="parameter">position</span> + <span class="types"><span class="type">int</span></span> + (default is at end) + (<em>optional</em>) + </li> + <li><span class="parameter">values</span> + <span class="types"><span class="type">array</span></span> + + + + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Comparing"></a>Comparing</h2> + + <dl class="function"> + <dt> + <a name = "deepcompare"></a> + <strong>deepcompare (t1, t2[, ignore_mt[, eps]])</strong> + </dt> + <dd> + compare two values. + if they are tables, then compare their keys and fields recursively. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + A value + </li> + <li><span class="parameter">t2</span> + A value + </li> + <li><span class="parameter">ignore_mt</span> + <span class="types"><span class="type">bool</span></span> + if true, ignore __eq metamethod (default false) + (<em>optional</em>) + </li> + <li><span class="parameter">eps</span> + <span class="types"><span class="type">number</span></span> + if defined, then used for any number comparisons + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + +</dd> + <dt> + <a name = "compare"></a> + <strong>compare (t1, t2, cmp)</strong> + </dt> + <dd> + compare two arrays using a predicate. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">array</span></span> + an array + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">array</span></span> + an array + </li> + <li><span class="parameter">cmp</span> + <span class="types"><span class="type">func</span></span> + A comparison function; <code>bool = cmp(t1_value, t2_value)</code> + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true or false + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="global">assert</span>(tablex.compare({ <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span> }, { <span class="number">1</span>, <span class="number">2</span>, <span class="number">3</span> }, <span class="string">"=="</span>)) + +<span class="global">assert</span>(tablex.compare( + {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>, hello = <span class="string">"world"</span>}, <span class="comment">-- fields are not compared! +</span> {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>}, <span class="keyword">function</span>(v1, v2) <span class="keyword">return</span> v1 == v2 <span class="keyword">end</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "compare_no_order"></a> + <strong>compare_no_order (t1, t2, cmp)</strong> + </dt> + <dd> + compare two list-like tables using an optional predicate, without regard for element order. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">cmp</span> + A comparison function (may be nil) + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Finding"></a>Finding</h2> + + <dl class="function"> + <dt> + <a name = "find"></a> + <strong>find (t, val, idx)</strong> + </dt> + <dd> + return the index of a value in a list. + Like string.find, there is an optional index to start searching, + which can be negative. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + A list-like table + </li> + <li><span class="parameter">val</span> + A value + </li> + <li><span class="parameter">idx</span> + <span class="types"><span class="type">int</span></span> + index to start; -1 means last element,etc (default 1) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + index of value or nil if not found + </ol> + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">find({<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>},<span class="number">20</span>) == <span class="number">2</span></pre></li> + <li><pre class="example">find({<span class="string">'a'</span>,<span class="string">'b'</span>,<span class="string">'a'</span>,<span class="string">'c'</span>},<span class="string">'a'</span>,<span class="number">2</span>) == <span class="number">3</span></pre></li> + </ul> + +</dd> + <dt> + <a name = "rfind"></a> + <strong>rfind (t, val, idx)</strong> + </dt> + <dd> + return the index of a value in a list, searching from the end. + Like string.find, there is an optional index to start searching, + which can be negative. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + A list-like table + </li> + <li><span class="parameter">val</span> + A value + </li> + <li><span class="parameter">idx</span> + index to start; -1 means last element,etc (default <code>#t</code>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + index of value or nil if not found + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">rfind({<span class="number">10</span>,<span class="number">10</span>,<span class="number">10</span>},<span class="number">10</span>) == <span class="number">3</span></pre> + </ul> + +</dd> + <dt> + <a name = "find_if"></a> + <strong>find_if (t, cmp, arg)</strong> + </dt> + <dd> + return the index (or key) of a value in a table using a comparison function. </p> + +<p> <em>NOTE</em>: the 2nd return value of this function, the value returned + by the comparison function, has a limitation that it cannot be <code>false</code>. + Because if it is, then it indicates the comparison failed, and the + function will continue the search. See examples. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + <li><span class="parameter">cmp</span> + <span class="types"><span class="type">func</span></span> + A comparison function + </li> + <li><span class="parameter">arg</span> + an optional second argument to the function + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + index of value, or nil if not found</li> + <li> + value returned by comparison function (cannot be <code>false</code>!)</li> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- using an operator +</span><span class="keyword">local</span> lst = { <span class="string">"Rudolph"</span>, <span class="keyword">true</span>, <span class="keyword">false</span>, <span class="number">15</span> } +<span class="keyword">local</span> idx, cmp_result = tablex.rfind(lst, <span class="string">"=="</span>, <span class="string">"Rudolph"</span>) +<span class="global">assert</span>(idx == <span class="number">1</span>) +<span class="global">assert</span>(cmp_result == <span class="keyword">true</span>) + +<span class="keyword">local</span> idx, cmp_result = tablex.rfind(lst, <span class="string">"=="</span>, <span class="keyword">false</span>) +<span class="global">assert</span>(idx == <span class="number">3</span>) +<span class="global">assert</span>(cmp_result == <span class="keyword">true</span>) <span class="comment">-- looking up 'false' works! +</span> +<span class="comment">-- using a function returning the value looked up +</span><span class="keyword">local</span> cmp = <span class="keyword">function</span>(v1, v2) <span class="keyword">return</span> v1 == v2 <span class="keyword">and</span> v2 <span class="keyword">end</span> +<span class="keyword">local</span> idx, cmp_result = tablex.rfind(lst, cmp, <span class="string">"Rudolph"</span>) +<span class="global">assert</span>(idx == <span class="number">1</span>) +<span class="global">assert</span>(cmp_result == <span class="string">"Rudolph"</span>) <span class="comment">-- the value is returned +</span> +<span class="comment">-- NOTE: this fails, since 'false' cannot be returned! +</span><span class="keyword">local</span> idx, cmp_result = tablex.rfind(lst, cmp, <span class="keyword">false</span>) +<span class="global">assert</span>(idx == <span class="keyword">nil</span>) <span class="comment">-- looking up 'false' failed! +</span><span class="global">assert</span>(cmp_result == <span class="keyword">nil</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "search"></a> + <strong>search (t, value[, exclude])</strong> + </dt> + <dd> + find a value in a table by recursive search. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + the table + </li> + <li><span class="parameter">value</span> + the value + </li> + <li><span class="parameter">exclude</span> + <span class="types"><span class="type">array</span></span> + any tables to avoid searching + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a fieldspec, e.g. 'a.b' or 'math.sin' + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">search(_G,<span class="global">math</span>.sin,{<span class="global">package</span>.path}) == <span class="string">'math.sin'</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="MappingAndFiltering"></a>MappingAndFiltering</h2> + + <dl class="function"> + <dt> + <a name = "map"></a> + <strong>map (fun, t, ...)</strong> + </dt> + <dd> + apply a function to all values of a table. + This returns a table of the results. + Any extra arguments are passed to the function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + A function that takes at least one argument + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + <li><span class="parameter">...</span> + optional arguments + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">map(<span class="keyword">function</span>(v) <span class="keyword">return</span> v*v <span class="keyword">end</span>, {<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>,fred=<span class="number">2</span>}) is {<span class="number">100</span>,<span class="number">400</span>,<span class="number">900</span>,fred=<span class="number">4</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "imap"></a> + <strong>imap (fun, t, ...)</strong> + </dt> + <dd> + apply a function to all values of a list. + This returns a table of the results. + Any extra arguments are passed to the function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + A function that takes at least one argument + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a table (applies to array part) + </li> + <li><span class="parameter">...</span> + optional arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list-like table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">imap(<span class="keyword">function</span>(v) <span class="keyword">return</span> v*v <span class="keyword">end</span>, {<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>,fred=<span class="number">2</span>}) is {<span class="number">100</span>,<span class="number">400</span>,<span class="number">900</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "map_named_method"></a> + <strong>map_named_method (name, t, ...)</strong> + </dt> + <dd> + apply a named method to values from a table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">name</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the method name + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">...</span> + any extra arguments to the method + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a <a href="../classes/pl.List.html">List</a> with the results of the method (1st result only) + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> Car = {} +Car.__index = Car +<span class="keyword">function</span> Car.new(car) + <span class="keyword">return</span> <span class="global">setmetatable</span>(car <span class="keyword">or</span> {}, Car) +<span class="keyword">end</span> +Car.speed = <span class="number">0</span> +<span class="keyword">function</span> Car:faster(increase) + self.speed = self.speed + increase + <span class="keyword">return</span> self.speed +<span class="keyword">end</span> + +<span class="keyword">local</span> ferrari = Car.new{ name = <span class="string">"Ferrari"</span> } +<span class="keyword">local</span> lamborghini = Car.new{ name = <span class="string">"Lamborghini"</span>, speed = <span class="number">50</span> } +<span class="keyword">local</span> cars = { ferrari, lamborghini } + +<span class="global">assert</span>(ferrari.speed == <span class="number">0</span>) +<span class="global">assert</span>(lamborghini.speed == <span class="number">50</span>) +tablex.map_named_method(<span class="string">"faster"</span>, cars, <span class="number">10</span>) +<span class="global">assert</span>(ferrari.speed == <span class="number">10</span>) +<span class="global">assert</span>(lamborghini.speed == <span class="number">60</span>)</pre> + </ul> + +</dd> + <dt> + <a name = "map2"></a> + <strong>map2 (fun, t1, t2, ...)</strong> + </dt> + <dd> + apply a function to values from two tables. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function of at least two arguments + </li> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">...</span> + extra arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">map2(<span class="string">'+'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,m=<span class="number">4</span>},{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>,m=<span class="number">40</span>}) is {<span class="number">11</span>,<span class="number">22</span>,<span class="number">23</span>,m=<span class="number">44</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "imap2"></a> + <strong>imap2 (fun, t1, t2, ...)</strong> + </dt> + <dd> + apply a function to values from two arrays. + The result will be the length of the shortest array. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function of at least two arguments + </li> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">...</span> + extra arguments + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">imap2(<span class="string">'+'</span>,{<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,m=<span class="number">4</span>},{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>,m=<span class="number">40</span>}) is {<span class="number">11</span>,<span class="number">22</span>,<span class="number">23</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "mapn"></a> + <strong>mapn (fun, ..., fun)</strong> + </dt> + <dd> + Apply a function to a number of tables. + A more general version of map + The result is a table containing the result of applying that function to the + ith value of each table. Length of output list is the minimum length of all the lists + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + A function that takes as many arguments as there are tables + </li> + <li><span class="parameter">...</span> + <span class="types"><span class="type">tab</span></span> + n tables + </li> + <li><span class="parameter">fun</span> + A function that takes as many arguments as there are tables + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">mapn(<span class="keyword">function</span>(x,y,z) <span class="keyword">return</span> x+y+z <span class="keyword">end</span>, {<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>},{<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>},{<span class="number">100</span>,<span class="number">200</span>,<span class="number">300</span>}) is {<span class="number">111</span>,<span class="number">222</span>,<span class="number">333</span>}</pre></li> + <li><pre class="example">mapn(<span class="global">math</span>.max, {<span class="number">1</span>,<span class="number">20</span>,<span class="number">300</span>},{<span class="number">10</span>,<span class="number">2</span>,<span class="number">3</span>},{<span class="number">100</span>,<span class="number">200</span>,<span class="number">100</span>}) is {<span class="number">100</span>,<span class="number">200</span>,<span class="number">300</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "pairmap"></a> + <strong>pairmap (fun, t, ...)</strong> + </dt> + <dd> + call the function with the key and value pairs from a table. + The function can return a value and a key (note the order!). If both + are not nil, then this pair is inserted into the result: if the key already exists, we convert the value for that + key into a table and append into it. If only value is not nil, then it is appended to the result. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + A function which will be passed each key and value as arguments, plus any extra arguments to pairmap. + </li> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + <li><span class="parameter">...</span> + optional arguments + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <li><pre class="example">pairmap(<span class="keyword">function</span>(k,v) <span class="keyword">return</span> v <span class="keyword">end</span>,{fred=<span class="number">10</span>,bonzo=<span class="number">20</span>}) is {<span class="number">10</span>,<span class="number">20</span>} _or_ {<span class="number">20</span>,<span class="number">10</span>}</pre></li> + <li><pre class="example">pairmap(<span class="keyword">function</span>(k,v) <span class="keyword">return</span> {k,v},k <span class="keyword">end</span>,{one=<span class="number">1</span>,two=<span class="number">2</span>}) is {one={<span class="string">'one'</span>,<span class="number">1</span>},two={<span class="string">'two'</span>,<span class="number">2</span>}}</pre></li> + </ul> + +</dd> + <dt> + <a name = "filter"></a> + <strong>filter (t, pred, arg)</strong> + </dt> + <dd> + filter an array's values using a predicate function + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">pred</span> + <span class="types"><span class="type">func</span></span> + a boolean function + </li> + <li><span class="parameter">arg</span> + optional argument to be passed as second argument of the predicate + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Iterating"></a>Iterating</h2> + + <dl class="function"> + <dt> + <a name = "foreach"></a> + <strong>foreach (t, fun, ...)</strong> + </dt> + <dd> + apply a function to all elements of a table. + The arguments to the function will be the value, + the key and <em>finally</em> any extra arguments passed to this function. + Note that the Lua 5.0 function table.foreach passed the <em>key</em> first. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function on the elements; <code>function(value, key, ...)</code> + </li> + <li><span class="parameter">...</span> + extra arguments passed to <code>fun</code> + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#transform">tablex.transform</a> + </ul> + + +</dd> + <dt> + <a name = "foreachi"></a> + <strong>foreachi (t, fun, ...)</strong> + </dt> + <dd> + apply a function to all elements of a list-like table in order. + The arguments to the function will be the value, + the index and <em>finally</em> any extra arguments passed to this function + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a table + </li> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a function with at least one argument + </li> + <li><span class="parameter">...</span> + optional arguments + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "sort"></a> + <strong>sort (t, f)</strong> + </dt> + <dd> + return an iterator to a table sorted by its keys + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + the table + </li> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + an optional comparison function (f(x,y) is true if x < y) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator to traverse elements sorted by the keys + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">for</span> k,v <span class="keyword">in</span> tablex.sort(t) <span class="keyword">do</span> <span class="global">print</span>(k,v) <span class="keyword">end</span></pre> + </ul> + +</dd> + <dt> + <a name = "sortv"></a> + <strong>sortv (t, f)</strong> + </dt> + <dd> + return an iterator to a table sorted by its values + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + the table + </li> + <li><span class="parameter">f</span> + <span class="types"><span class="type">func</span></span> + an optional comparison function (f(x,y) is true if x < y) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an iterator to traverse elements sorted by the values + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">for</span> k,v <span class="keyword">in</span> tablex.sortv(t) <span class="keyword">do</span> <span class="global">print</span>(k,v) <span class="keyword">end</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Extraction"></a>Extraction</h2> + + <dl class="function"> + <dt> + <a name = "keys"></a> + <strong>keys (t)</strong> + </dt> + <dd> + return all the keys of a table in arbitrary order. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "values"></a> + <strong>values (t)</strong> + </dt> + <dd> + return all the values of the table in arbitrary order + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">tab</span></span> + A table + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "sub"></a> + <strong>sub (t, first, last)</strong> + </dt> + <dd> + Extract a range from a table, like 'string.sub'. + If first or last are negative then they are relative to the end of the list + eg. sub(t,-2) gives last 2 entries in a list, and + sub(t,-4,-2) gives from -4th to -2nd + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + <span class="types"><span class="type">array</span></span> + a list-like table + </li> + <li><span class="parameter">first</span> + <span class="types"><span class="type">int</span></span> + An index + </li> + <li><span class="parameter">last</span> + <span class="types"><span class="type">int</span></span> + An index + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a new List + </ol> + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Merging"></a>Merging</h2> + + <dl class="function"> + <dt> + <a name = "merge"></a> + <strong>merge (t1, t2, dup)</strong> + </dt> + <dd> + combine two tables, either as union or intersection. Corresponds to + set operations for sets () but more general. Not particularly + useful for list-like tables. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">t2</span> + <span class="types"><span class="type">tab</span></span> + a table + </li> + <li><span class="parameter">dup</span> + <span class="types"><span class="type">bool</span></span> + true for a union, false for an intersection. + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.tablex.html#index_map">tablex.index_map</a> + </ul> + + <h3>Usage:</h3> + <ul> + <li><pre class="example">merge({alice=<span class="number">23</span>,fred=<span class="number">34</span>},{bob=<span class="number">25</span>,fred=<span class="number">34</span>}) is {fred=<span class="number">34</span>}</pre></li> + <li><pre class="example">merge({alice=<span class="number">23</span>,fred=<span class="number">34</span>},{bob=<span class="number">25</span>,fred=<span class="number">34</span>},<span class="keyword">true</span>) is {bob=<span class="number">25</span>,fred=<span class="number">34</span>,alice=<span class="number">23</span>}</pre></li> + </ul> + +</dd> + <dt> + <a name = "difference"></a> + <strong>difference (s1, s2, symm)</strong> + </dt> + <dd> + a new table which is the difference of two tables. + With sets (where the values are all true) this is set difference and + symmetric difference depending on the third parameter. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s1</span> + <span class="types"><span class="type">tab</span></span> + a map-like table or set + </li> + <li><span class="parameter">s2</span> + <span class="types"><span class="type">tab</span></span> + a map-like table or set + </li> + <li><span class="parameter">symm</span> + <span class="types"><span class="type">bool</span></span> + symmetric difference (default false) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a map-like table or set + </ol> + + + + +</dd> + <dt> + <a name = "zip"></a> + <strong>zip (...)</strong> + </dt> + <dd> + return a table where each element is a table of the ith values of an arbitrary + number of tables. It is equivalent to a matrix transpose. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + <span class="types"><span class="type">array</span></span> + arrays to be zipped + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">zip({<span class="number">10</span>,<span class="number">20</span>,<span class="number">30</span>},{<span class="number">100</span>,<span class="number">200</span>,<span class="number">300</span>}) is {{<span class="number">10</span>,<span class="number">100</span>},{<span class="number">20</span>,<span class="number">200</span>},{<span class="number">30</span>,<span class="number">300</span>}}</pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.template.html b/Data/Libraries/Penlight/docs/libraries/pl.template.html new file mode 100644 index 0000000..c2ac2c0 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.template.html @@ -0,0 +1,336 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><strong>pl.template</strong></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.template</code></h1> +<p>A template preprocessor.</p> +<p> Originally by <a href="http://lua-users.org/wiki/SlightlyLessSimpleLuaPreprocessor">Ricki Lake</a></p> + +<p> There are two rules:</p> + +<ul> + <li>lines starting with # are Lua</li> + <li>otherwise, <code>$(expr)</code> is the result of evaluating <code>expr</code></li> +</ul> + +<p> Example:</p> + + +<pre> +# <span class="keyword">for</span> i = <span class="number">1</span>,<span class="number">3</span> <span class="keyword">do</span> + $(i) Hello, Word! +# <span class="keyword">end</span> +===> +<span class="number">1</span> Hello, Word! +<span class="number">2</span> Hello, Word! +<span class="number">3</span> Hello, Word! +</pre> + +<p> Other escape characters can be used, when the defaults conflict + with the output language.</p> + + +<pre> +> <span class="keyword">for</span> _,n <span class="keyword">in</span> <span class="global">pairs</span>{<span class="string">'one'</span>,<span class="string">'two'</span>,<span class="string">'three'</span>} <span class="keyword">do</span> +static int l_${n} (luaState *state); +> <span class="keyword">end</span> +</pre> + +<p> See <a href="../manual/03-strings.md.html#Another_Style_of_Template">the Guide</a>.</p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#substitute">substitute (str[, env])</a></td> + <td class="summary">expand the template using the specified environment.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#ct:render">ct:render ([env[, parent[, db]]])</a></td> + <td class="summary">executes the previously compiled template and renders it.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compile">compile (str[, opts])</a></td> + <td class="summary">compiles the template.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "substitute"></a> + <strong>substitute (str[, env])</strong> + </dt> + <dd> + +<p>expand the template using the specified environment. + This function will compile and render the template. For more performant + recurring usage use the two step approach by using <a href="../libraries/pl.template.html#compile">compile</a> and <a href="../libraries/pl.template.html#ct:render">ct:render</a>. + There are six special fields in the environment table <code>env</code></p> + +<ul> + <li><code>_parent</code>: continue looking up in this table (e.g. <code>_parent=_G</code>).</li> + <li><code>_brackets</code>: bracket pair that wraps inline Lua expressions, default is '()'.</li> + <li><code>_escape</code>: character marking Lua lines, default is '#'</li> + <li><code>_inline_escape</code>: character marking inline Lua expression, default is '$'.</li> + <li><code>_chunk_name</code>: chunk name for loaded templates, used if there + is an error in Lua code. Default is 'TMP'.</li> + <li><code>_debug</code>: if truthy, the generated code will be printed upon a render error</li> +</ul> + + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the template string + </li> + <li><span class="parameter">env</span> + <span class="types"><span class="type">tab</span></span> + the environment + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>rendered template + nil + source_code</code>, or <code>nil + error + source_code</code>. The last + return value (<code>source_code</code>) is only returned if the debug option is used. + </ol> + + + + +</dd> + <dt> + <a name = "ct:render"></a> + <strong>ct:render ([env[, parent[, db]]])</strong> + </dt> + <dd> + executes the previously compiled template and renders it. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">env</span> + <span class="types"><span class="type">tab</span></span> + the environment. + (<em>optional</em>) + </li> + <li><span class="parameter">parent</span> + <span class="types"><span class="type">tab</span></span> + continue looking up in this table (e.g. <code>parent=_G</code>). + (<em>optional</em>) + </li> + <li><span class="parameter">db</span> + <span class="types"><span class="type">bool</span></span> + if thruthy, it will print the code upon a render error + (provided the template was compiled with the debug option). + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>rendered template + nil + source_code</code>, or <code>nil + error + source_code</code>. The last return value + (<code>source_code</code>) is only returned if the template was compiled with the debug option. + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> ct, err = template.compile(my_template) +<span class="keyword">local</span> rendered , err = ct:render(my_env, parent)</pre> + </ul> + +</dd> + <dt> + <a name = "compile"></a> + <strong>compile (str[, opts])</strong> + </dt> + <dd> + +<p>compiles the template. + Returns an object that can repeatedly be rendered without parsing/compiling + the template again. + The options passed in the <code>opts</code> table support the following options:</p> + +<ul> + <li><code>chunk_name</code>: chunk name for loaded templates, used if there + is an error in Lua code. Default is 'TMP'.</li> + <li><code>escape</code>: character marking Lua lines, default is '#'</li> + <li><code>inline_escape</code>: character marking inline Lua expression, default is '$'.</li> + <li><code>inline_brackets</code>: bracket pair that wraps inline Lua expressions, default is '()'.</li> + <li><code>newline</code>: string to replace newline characters, default is <code>nil</code> (not replacing newlines).</li> + <li><a href="https://www.lua.org/manual/5.1/manual.html#5.9">debug</a>: if truthy, the generated source code will be retained within the compiled template object, default is <code>nil</code>.</li> +</ul> + + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">str</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the template string + </li> + <li><span class="parameter">opts</span> + <span class="types"><span class="type">tab</span></span> + the compilation options to use + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + template object, or <code>nil + error + source_code</code> + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> ct, err = template.compile(my_template) +<span class="keyword">local</span> rendered , err = ct:render(my_env, parent)</pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.test.html b/Data/Libraries/Penlight/docs/libraries/pl.test.html new file mode 100644 index 0000000..72aff1d --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.test.html @@ -0,0 +1,445 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><strong>pl.test</strong></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.test</code></h1> +<p>Useful test utilities.</p> +<p> + + + +<pre> +test.asserteq({<span class="number">1</span>,<span class="number">2</span>},{<span class="number">1</span>,<span class="number">2</span>}) <span class="comment">-- can compare tables +</span>test.asserteq(<span class="number">1.2</span>,<span class="number">1.19</span>,<span class="number">0.02</span>) <span class="comment">-- compare FP numbers within precision +</span>T = test.tuple <span class="comment">-- used for comparing multiple results +</span>test.asserteq(T(<span class="global">string</span>.find(<span class="string">" me"</span>,<span class="string">"me"</span>)),T(<span class="number">2</span>,<span class="number">3</span>)) +</pre> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.tablex.html#">pl.tablex</a>, <a href="../libraries/pl.pretty.html#">pl.pretty</a>, <a href="../libraries/pl.path.html#">pl.path</a>, <a href="https://www.lua.org/manual/5.1/manual.html#5.9">debug</a></p> +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#error_handler">error_handler (file, line, got_text, needed_text, msg)</a></td> + <td class="summary">error handling for test results.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#complain">complain (x, y, msg, where)</a></td> + <td class="summary">general test complain message.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#asserteq">asserteq (x, y, eps, where)</a></td> + <td class="summary">like assert, except takes two arguments that must be equal and can be tables.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#assertmatch">assertmatch (s1, s2, where)</a></td> + <td class="summary">assert that the first string matches the second.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#assertraise">assertraise (fn, e, where)</a></td> + <td class="summary">assert that the function raises a particular error.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#asserteq2">asserteq2 (x1, x2, y1, y2, where)</a></td> + <td class="summary">a version of asserteq that takes two pairs of values.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#tuple">tuple (...)</a></td> + <td class="summary">encode an arbitrary argument list as a tuple.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#timer">timer (msg, n, fun, ...)</a></td> + <td class="summary">Time a function.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "error_handler"></a> + <strong>error_handler (file, line, got_text, needed_text, msg)</strong> + </dt> + <dd> + error handling for test results. + By default, this writes to stderr and exits the program. + Re-define this function to raise an error and/or redirect output + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">file</span> + + + + </li> + <li><span class="parameter">line</span> + + + + </li> + <li><span class="parameter">got_text</span> + + + + </li> + <li><span class="parameter">needed_text</span> + + + + </li> + <li><span class="parameter">msg</span> + + + + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "complain"></a> + <strong>complain (x, y, msg, where)</strong> + </dt> + <dd> + general test complain message. + Useful for composing new test functions (see tests/tablex.lua for an example) + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">x</span> + a value + </li> + <li><span class="parameter">y</span> + value to compare first value against + </li> + <li><span class="parameter">msg</span> + message + </li> + <li><span class="parameter">where</span> + extra level offset for errors + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "asserteq"></a> + <strong>asserteq (x, y, eps, where)</strong> + </dt> + <dd> + like assert, except takes two arguments that must be equal and can be tables. + If they are plain tables, it will use tablex.deepcompare. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">x</span> + any value + </li> + <li><span class="parameter">y</span> + a value equal to x + </li> + <li><span class="parameter">eps</span> + an optional tolerance for numerical comparisons + </li> + <li><span class="parameter">where</span> + extra level offset + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "assertmatch"></a> + <strong>assertmatch (s1, s2, where)</strong> + </dt> + <dd> + assert that the first string matches the second. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s1</span> + a string + </li> + <li><span class="parameter">s2</span> + a string + </li> + <li><span class="parameter">where</span> + extra level offset + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "assertraise"></a> + <strong>assertraise (fn, e, where)</strong> + </dt> + <dd> + assert that the function raises a particular error. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + a function or a table of the form {function,arg1,...} + </li> + <li><span class="parameter">e</span> + a string to match the error against + </li> + <li><span class="parameter">where</span> + extra level offset + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "asserteq2"></a> + <strong>asserteq2 (x1, x2, y1, y2, where)</strong> + </dt> + <dd> + a version of asserteq that takes two pairs of values. + <code>x1==y1 and x2==y2</code> must be true. Useful for functions that naturally + return two values. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">x1</span> + any value + </li> + <li><span class="parameter">x2</span> + any value + </li> + <li><span class="parameter">y1</span> + any value + </li> + <li><span class="parameter">y2</span> + any value + </li> + <li><span class="parameter">where</span> + extra level offset + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "tuple"></a> + <strong>tuple (...)</strong> + </dt> + <dd> + encode an arbitrary argument list as a tuple. + This can be used to compare to other argument lists, which is + very useful for testing functions which return a number of values. + Unlike regular array-like tables ('sequences') they may contain nils. + Tuples understand equality and know how to print themselves out. + The # operator is defined to be the size, irrespecive of any nils, + and there is an <a href="https://www.lua.org/manual/5.1/manual.html#pdf-unpack">unpack</a> method. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + + + + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example">asserteq(tuple( (<span class="string">'ab'</span>):find <span class="string">'a'</span>), tuple(<span class="number">1</span>,<span class="number">1</span>))</pre> + </ul> + +</dd> + <dt> + <a name = "timer"></a> + <strong>timer (msg, n, fun, ...)</strong> + </dt> + <dd> + Time a function. Call the function a given number of times, and report the number of seconds taken, + together with a message. Any extra arguments will be passed to the function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">msg</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + a descriptive message + </li> + <li><span class="parameter">n</span> + <span class="types"><span class="type">int</span></span> + number of times to call the function + </li> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + the function + </li> + <li><span class="parameter">...</span> + optional arguments to fun + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.text.html b/Data/Libraries/Penlight/docs/libraries/pl.text.html new file mode 100644 index 0000000..77b7db1 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.text.html @@ -0,0 +1,381 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><strong>pl.text</strong></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.text</code></h1> +<p>Text processing utilities.</p> +<p> This provides a Template class (modeled after the same from the Python + libraries, see string.Template). It also provides similar functions to those + found in the textwrap module.</p> + +<p> See <a href="../manual/03-strings.md.html#String_Templates">the Guide</a>.</p> + +<p> Calling <code>text.format_operator()</code> overloads the % operator for strings to give Python/Ruby style formated output. + This is extended to also do template-like substitution for map-like data.</p> + + +<pre> +> <span class="global">require</span> <span class="string">'pl.text'</span>.format_operator() +> = <span class="string">'%s = %5.3f'</span> % {<span class="string">'PI'</span>,<span class="global">math</span>.pi} +PI = <span class="number">3.142</span> +> = <span class="string">'$name = $value'</span> % {name=<span class="string">'dog'</span>,value=<span class="string">'Pluto'</span>} +dog = Pluto +</pre> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a>, <a href="../libraries/pl.types.html#">pl.types</a></p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#indent">indent (s, n, ch)</a></td> + <td class="summary">indent a multiline string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#dedent">dedent (s)</a></td> + <td class="summary">dedent a multiline string by removing any initial indent.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#wrap">wrap (s, width)</a></td> + <td class="summary">format a paragraph into lines so that they fit into a line width.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#fill">fill (s, width)</a></td> + <td class="summary">format a paragraph so that it fits into a line width.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Template:substitute">Template:substitute (tbl)</a></td> + <td class="summary">substitute values into a template, throwing an error.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Template:safe_substitute">Template:safe_substitute (tbl)</a></td> + <td class="summary">substitute values into a template.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Template:indent_substitute">Template:indent_substitute (tbl)</a></td> + <td class="summary">substitute values into a template, preserving indentation.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "indent"></a> + <strong>indent (s, n, ch)</strong> + </dt> + <dd> + indent a multiline string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the string + </li> + <li><span class="parameter">n</span> + the size of the indent + </li> + <li><span class="parameter">ch</span> + the character to use when indenting (default ' ') + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + indented string + </ol> + + + + +</dd> + <dt> + <a name = "dedent"></a> + <strong>dedent (s)</strong> + </dt> + <dd> + dedent a multiline string by removing any initial indent. + useful when working with [[..]] strings. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string with initial indent zero. + </ol> + + + + +</dd> + <dt> + <a name = "wrap"></a> + <strong>wrap (s, width)</strong> + </dt> + <dd> + format a paragraph into lines so that they fit into a line width. + It will not break long words, so lines can be over the length + to that extent. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the string + </li> + <li><span class="parameter">width</span> + the margin width, default 70 + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list of lines (List object) + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../classes/pl.List.html#">pl.List</a> + </ul> + + +</dd> + <dt> + <a name = "fill"></a> + <strong>fill (s, width)</strong> + </dt> + <dd> + format a paragraph so that it fits into a line width. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the string + </li> + <li><span class="parameter">width</span> + the margin width, default 70 + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.text.html#wrap">wrap</a> + </ul> + + +</dd> + <dt> + <a name = "Template:substitute"></a> + <strong>Template:substitute (tbl)</strong> + </dt> + <dd> + substitute values into a template, throwing an error. + This will throw an error if no name is found. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tbl</span> + a table of name-value pairs. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Template:safe_substitute"></a> + <strong>Template:safe_substitute (tbl)</strong> + </dt> + <dd> + substitute values into a template. + This version just passes unknown names through. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tbl</span> + a table of name-value pairs. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Template:indent_substitute"></a> + <strong>Template:indent_substitute (tbl)</strong> + </dt> + <dd> + substitute values into a template, preserving indentation. <br> + If the value is a multiline string <em>or</em> a template, it will insert + the lines at the correct indentation. <br> + Furthermore, if a template, then that template will be subsituted + using the same table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tbl</span> + a table of name-value pairs. + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.types.html b/Data/Libraries/Penlight/docs/libraries/pl.types.html new file mode 100644 index 0000000..252005e --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.types.html @@ -0,0 +1,475 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><strong>pl.types</strong></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.types</code></h1> +<p>Dealing with Detailed Type Information</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#is_callable">is_callable (obj)</a></td> + <td class="summary">is the object either a function or a callable object?.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_type">is_type (obj, tp)</a></td> + <td class="summary">is the object of the specified type?.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#type">type (obj)</a></td> + <td class="summary">a string representation of a type.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_integer">is_integer (x)</a></td> + <td class="summary">is this number an integer?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_empty">is_empty (o, ignore_spaces)</a></td> + <td class="summary">Check if the object is "empty".</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_indexable">is_indexable (val)</a></td> + <td class="summary">is an object 'array-like'?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_iterable">is_iterable (val)</a></td> + <td class="summary">can an object be iterated over with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a>?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_writeable">is_writeable (val)</a></td> + <td class="summary">can an object accept new key/pair values?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#to_bool">to_bool (o[, true_strs[, check_objs]])</a></td> + <td class="summary">Convert to a boolean value.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "is_callable"></a> + <strong>is_callable (obj)</strong> + </dt> + <dd> + is the object either a function or a callable object?. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">obj</span> + Object to check. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "is_type"></a> + <strong>is_type (obj, tp)</strong> + </dt> + <dd> + is the object of the specified type?. + If the type is a string, then use type, otherwise compare with metatable.</p> + +<p> NOTE: this function is imported from <a href="../libraries/pl.utils.html#is_type">utils.is_type</a>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">obj</span> + An object to check + </li> + <li><span class="parameter">tp</span> + The expected type + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#is_type">utils.is_type</a> + </ul> + + +</dd> + <dt> + <a name = "type"></a> + <strong>type (obj)</strong> + </dt> + <dd> + a string representation of a type. + For tables and userdata with metatables, we assume that the metatable has a <code>_name</code> + field. If the field is not present it will return 'unknown table' or + 'unknown userdata'. + Lua file objects return the type 'file'. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">obj</span> + an object + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string like 'number', 'table', 'file' or 'List' + </ol> + + + + +</dd> + <dt> + <a name = "is_integer"></a> + <strong>is_integer (x)</strong> + </dt> + <dd> + is this number an integer? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">x</span> + a number + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + boolean + </ol> + + <h3>Raises:</h3> + error if x is not a number + + + +</dd> + <dt> + <a name = "is_empty"></a> + <strong>is_empty (o, ignore_spaces)</strong> + </dt> + <dd> + +<p>Check if the object is "empty". + An object is considered empty if it is:</p> + +<ul> + <li><code>nil</code></li> + <li>a table without any items (key-value pairs or indexes)</li> + <li>a string with no content ("")</li> + <li>not a nil/table/string</li> +</ul> + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">o</span> + The object to check if it is empty. + </li> + <li><span class="parameter">ignore_spaces</span> + If the object is a string and this is true the string is + considered empty if it only contains spaces. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if the object is empty, otherwise a falsy value. + </ol> + + + + +</dd> + <dt> + <a name = "is_indexable"></a> + <strong>is_indexable (val)</strong> + </dt> + <dd> + is an object 'array-like'? + An object is array like if:</p> + +<ul> + <li>it is a table, or</li> + <li>it has a metatable with <code>__len</code> and <code>__index</code> methods</li> +</ul> + +<p> NOTE: since <code>__len</code> is 5.2+, on 5.1 is usually returns <code>false</code> for userdata + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">val</span> + any value. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if the object is array-like, otherwise a falsy value. + </ol> + + + + +</dd> + <dt> + <a name = "is_iterable"></a> + <strong>is_iterable (val)</strong> + </dt> + <dd> + can an object be iterated over with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pairs">pairs</a>? + An object is iterable if:</p> + +<ul> + <li>it is a table, or</li> + <li>it has a metatable with a <code>__pairs</code> meta method</li> +</ul> + +<p> NOTE: since <code>__pairs</code> is 5.2+, on 5.1 is usually returns <code>false</code> for userdata + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">val</span> + any value. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if the object is iterable, otherwise a falsy value. + </ol> + + + + +</dd> + <dt> + <a name = "is_writeable"></a> + <strong>is_writeable (val)</strong> + </dt> + <dd> + +<p>can an object accept new key/pair values? + An object is iterable if:</p> + +<ul> + <li>it is a table, or</li> + <li>it has a metatable with a <code>__newindex</code> meta method</li> +</ul> + + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">val</span> + any value. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + <code>true</code> if the object is writeable, otherwise a falsy value. + </ol> + + + + +</dd> + <dt> + <a name = "to_bool"></a> + <strong>to_bool (o[, true_strs[, check_objs]])</strong> + </dt> + <dd> + +<p>Convert to a boolean value. + True values are:</p> + +<ul> + <li>boolean: true.</li> + <li>string: 'yes', 'y', 'true', 't', '1' or additional strings specified by <code>true_strs</code>.</li> + <li>number: Any non-zero value.</li> + <li>table: Is not empty and <code>check_objs</code> is true.</li> + <li>everything else: Is not <code>nil</code> and <code>check_objs</code> is true.</li> +</ul> + + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">o</span> + The object to evaluate. + </li> + <li><span class="parameter">true_strs</span> + optional Additional strings that when matched should evaluate to true. Comparison is case insensitive. + This should be a List of strings. E.g. "ja" to support German. + (<em>optional</em>) + </li> + <li><span class="parameter">check_objs</span> + True if objects should be evaluated. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + true if the input evaluates to true, otherwise false. + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.url.html b/Data/Libraries/Penlight/docs/libraries/pl.url.html new file mode 100644 index 0000000..7c97371 --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.url.html @@ -0,0 +1,212 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><strong>pl.url</strong></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.url</code></h1> +<p>Python-style URL quoting library.</p> +<p> + +</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#quote">quote (s, quote_plus)</a></td> + <td class="summary">Quote the url, replacing special characters using the '%xx' escape.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#unquote">unquote (s)</a></td> + <td class="summary">Unquote the url, replacing '%xx' escapes and plus signs.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "quote"></a> + <strong>quote (s, quote_plus)</strong> + </dt> + <dd> + Quote the url, replacing special characters using the '%xx' escape. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + <li><span class="parameter">quote_plus</span> + <span class="types"><span class="type">bool</span></span> + Also escape slashes and replace spaces by plus signs. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + The quoted string, or if <code>s</code> wasn't a string, just plain unaltered <code>s</code>. + </ol> + + + + +</dd> + <dt> + <a name = "unquote"></a> + <strong>unquote (s)</strong> + </dt> + <dd> + Unquote the url, replacing '%xx' escapes and plus signs. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> + the string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + The unquoted string, or if <code>s</code> wasn't a string, just plain unaltered <code>s</code>. + </ol> + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.utils.html b/Data/Libraries/Penlight/docs/libraries/pl.utils.html new file mode 100644 index 0000000..ee1773a --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.utils.html @@ -0,0 +1,1384 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +<li><a href="#Tables">Tables</a></li> +<li><a href="#Error_handling">Error handling </a></li> +<li><a href="#File_handling">File handling </a></li> +<li><a href="#OS_functions">OS functions </a></li> +<li><a href="#String_functions">String functions </a></li> +<li><a href="#Functional">Functional </a></li> +<li><a href="#Deprecation">Deprecation </a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><strong>pl.utils</strong></li> + <li><a href="../libraries/pl.xml.html">pl.xml</a></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.utils</code></h1> +<p>Generally useful routines.</p> +<p> See <a href="../manual/01-introduction.md.html#Generally_useful_functions_">the Guide</a>.</p> + +<p> Dependencies: <a href="../libraries/pl.compat.html#">pl.compat</a>, all exported fields and functions from + <a href="../libraries/pl.compat.html#">pl.compat</a> are also available in this module.</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#pack">pack (...)</a></td> + <td class="summary">pack an argument list into a table.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#unpack">unpack (t[, i[, t]])</a></td> + <td class="summary">unpack a table and return its contents.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#printf">printf (fmt, ...)</a></td> + <td class="summary">print an arbitrary number of arguments using a format.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#fprintf">fprintf (f, fmt, ...)</a></td> + <td class="summary">write an arbitrary number of arguments to a file using a format.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#import">import (t, T)</a></td> + <td class="summary">take a table and 'inject' it into the local namespace.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#choose">choose (cond, value1, value2)</a></td> + <td class="summary">return either of two values, depending on a condition.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#array_tostring">array_tostring (t[, temp[, tostr]])</a></td> + <td class="summary">convert an array of values to strings.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_type">is_type (obj, tp)</a></td> + <td class="summary">is the object of the specified type?</td> + </tr> +</table> +<h2><a href="#Tables">Tables</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#patterns">patterns</a></td> + <td class="summary">Some standard patterns</td> + </tr> + <tr> + <td class="name" nowrap><a href="#stdmt">stdmt</a></td> + <td class="summary">Standard meta-tables as used by other Penlight modules</td> + </tr> +</table> +<h2><a href="#Error_handling">Error handling </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#assert_arg">assert_arg (n, val, tp, verify, msg, lev)</a></td> + <td class="summary">assert that the given argument is in fact of the correct type.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#function_arg">function_arg (idx, f, msg)</a></td> + <td class="summary">process a function argument.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#assert_string">assert_string (n, val)</a></td> + <td class="summary">assert the common case that the argument is a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#on_error">on_error (mode)</a></td> + <td class="summary">control the error strategy used by Penlight.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#raise">raise (err)</a></td> + <td class="summary">used by Penlight functions to return errors.</td> + </tr> +</table> +<h2><a href="#File_handling">File handling </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#readfile">readfile (filename, is_bin)</a></td> + <td class="summary">return the contents of a file as a string</td> + </tr> + <tr> + <td class="name" nowrap><a href="#writefile">writefile (filename, str, is_bin)</a></td> + <td class="summary">write a string to a file</td> + </tr> + <tr> + <td class="name" nowrap><a href="#readlines">readlines (filename)</a></td> + <td class="summary">return the contents of a file as a list of lines</td> + </tr> +</table> +<h2><a href="#OS_functions">OS functions </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#executeex">executeex (cmd, bin)</a></td> + <td class="summary">execute a shell command and return the output.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#quote_arg">quote_arg (argument)</a></td> + <td class="summary">Quote and escape an argument of a command.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#quit">quit ([code], msg, ...)</a></td> + <td class="summary">error out of this program gracefully.</td> + </tr> +</table> +<h2><a href="#String_functions">String functions </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#escape">escape (s)</a></td> + <td class="summary">escape any Lua 'magic' characters in a string</td> + </tr> + <tr> + <td class="name" nowrap><a href="#split">split (s, re, plain, n)</a></td> + <td class="summary">split a string into a list of strings separated by a delimiter.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#splitv">splitv (s, re, plain, n)</a></td> + <td class="summary">split a string into a number of return values.</td> + </tr> +</table> +<h2><a href="#Functional">Functional </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#memoize">memoize (func)</a></td> + <td class="summary">'memoize' a function (cache returned value for next call).</td> + </tr> + <tr> + <td class="name" nowrap><a href="#add_function_factory">add_function_factory (mt, fun)</a></td> + <td class="summary">associate a function factory with a type.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#string_lambda">string_lambda (lf)</a></td> + <td class="summary">an anonymous function as a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#bind1">bind1 (fn, p)</a></td> + <td class="summary">bind the first argument of the function to a value.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#bind2">bind2 (fn, p)</a></td> + <td class="summary">bind the second argument of the function to a value.</td> + </tr> +</table> +<h2><a href="#Deprecation">Deprecation </a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#set_deprecation_func">set_deprecation_func (func)</a></td> + <td class="summary">Sets a deprecation warning function.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#raise_deprecation">raise_deprecation (opts)</a></td> + <td class="summary">raises a deprecation warning.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "pack"></a> + <strong>pack (...)</strong> + </dt> + <dd> + pack an argument list into a table. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">...</span> + any arguments + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a table with field <code>n</code> set to the length + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.compat.html#table.pack">compat.pack</a> + </ul> + + +</dd> + <dt> + <a name = "unpack"></a> + <strong>unpack (t[, i[, t]])</strong> + </dt> + <dd> + unpack a table and return its contents. </p> + +<p> NOTE: this implementation differs from the Lua implementation in the way + that this one DOES honor the <code>n</code> field in the table <code>t</code>, such that it is 'nil-safe'. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + index of the last element to unpack, defaults to <code>t.n</code> or <code>#t</code> + (<em>optional</em>) + </li> + <li><span class="parameter">i</span> + index from which to start unpacking, defaults to 1 + (<em>optional</em>) + </li> + <li><span class="parameter">t</span> + index of the last element to unpack, defaults to <code>t.n</code> or <code>#t</code> + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + multiple return values from the table + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.compat.html#table.unpack">compat.unpack</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> t = <span class="global">table</span>.pack(<span class="keyword">nil</span>, <span class="keyword">nil</span>, <span class="keyword">nil</span>, <span class="number">4</span>) +<span class="keyword">local</span> a, b, c, d = <span class="global">table</span>.<span class="global">unpack</span>(t) <span class="comment">-- this <a href="../libraries/pl.utils.html#unpack">unpack</a> is NOT nil-safe, so d == nil +</span> +<span class="keyword">local</span> a, b, c, d = utils.<span class="global">unpack</span>(t) <span class="comment">-- this is nil-safe, so d == 4</span></pre> + </ul> + +</dd> + <dt> + <a name = "printf"></a> + <strong>printf (fmt, ...)</strong> + </dt> + <dd> + print an arbitrary number of arguments using a format. + Output will be sent to <code>stdout</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fmt</span> + The format (see <a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.format">string.format</a>) + </li> + <li><span class="parameter">...</span> + Extra arguments for format + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "fprintf"></a> + <strong>fprintf (f, fmt, ...)</strong> + </dt> + <dd> + write an arbitrary number of arguments to a file using a format. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">f</span> + File handle to write to. + </li> + <li><span class="parameter">fmt</span> + The format (see <a href="https://www.lua.org/manual/5.1/manual.html#pdf-string.format">string.format</a>). + </li> + <li><span class="parameter">...</span> + Extra arguments for format + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "import"></a> + <strong>import (t, T)</strong> + </dt> + <dd> + take a table and 'inject' it into the local namespace. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + The table (table), or module name (string), defaults to this <a href="../libraries/pl.utils.html">utils</a> module table + </li> + <li><span class="parameter">T</span> + An optional destination table (defaults to callers environment) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "choose"></a> + <strong>choose (cond, value1, value2)</strong> + </dt> + <dd> + return either of two values, depending on a condition. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">cond</span> + A condition + </li> + <li><span class="parameter">value1</span> + Value returned if cond is truthy + </li> + <li><span class="parameter">value2</span> + Value returned if cond is falsy + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "array_tostring"></a> + <strong>array_tostring (t[, temp[, tostr]])</strong> + </dt> + <dd> + convert an array of values to strings. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + a list-like table + </li> + <li><span class="parameter">temp</span> + (table) buffer to use, otherwise allocate + (<em>optional</em>) + </li> + <li><span class="parameter">tostr</span> + custom tostring function, called with (value,index). Defaults to <a href="https://www.lua.org/manual/5.1/manual.html#pdf-tostring">tostring</a>. + (<em>optional</em>) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the converted buffer + </ol> + + + + +</dd> + <dt> + <a name = "is_type"></a> + <strong>is_type (obj, tp)</strong> + </dt> + <dd> + is the object of the specified type? + If the type is a string, then use type, otherwise compare with metatable + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">obj</span> + An object to check + </li> + <li><span class="parameter">tp</span> + String of what type it should be + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + boolean + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">utils.is_type(<span class="string">"hello world"</span>, <span class="string">"string"</span>) <span class="comment">--> true +</span><span class="comment">-- or check metatable +</span><span class="keyword">local</span> my_mt = {} +<span class="keyword">local</span> my_obj = <span class="global">setmetatable</span>(my_obj, my_mt) +utils.is_type(my_obj, my_mt) <span class="comment">--> true</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Tables"></a>Tables</h2> + + <dl class="function"> + <dt> + <a name = "patterns"></a> + <strong>patterns</strong> + </dt> + <dd> + Some standard patterns + + + <h3>Fields:</h3> + <ul> + <li><span class="parameter">FLOAT</span> + floating point number + </li> + <li><span class="parameter">INTEGER</span> + integer number + </li> + <li><span class="parameter">IDEN</span> + identifier + </li> + <li><span class="parameter">FILE</span> + file + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "stdmt"></a> + <strong>stdmt</strong> + </dt> + <dd> + Standard meta-tables as used by other Penlight modules + + + <h3>Fields:</h3> + <ul> + <li><span class="parameter">List</span> + the List metatable + </li> + <li><span class="parameter">Map</span> + the Map metatable + </li> + <li><span class="parameter">Set</span> + the Set metatable + </li> + <li><span class="parameter">MultiMap</span> + the MultiMap metatable + </li> + </ul> + + + + + +</dd> +</dl> + <h2 class="section-header "><a name="Error_handling"></a>Error handling </h2> + + <dl class="function"> + <dt> + <a name = "assert_arg"></a> + <strong>assert_arg (n, val, tp, verify, msg, lev)</strong> + </dt> + <dd> + assert that the given argument is in fact of the correct type. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">n</span> + argument index + </li> + <li><span class="parameter">val</span> + the value + </li> + <li><span class="parameter">tp</span> + the type + </li> + <li><span class="parameter">verify</span> + an optional verification function + </li> + <li><span class="parameter">msg</span> + an optional custom message + </li> + <li><span class="parameter">lev</span> + optional stack position for trace, default 2 + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the validated value + </ol> + + <h3>Raises:</h3> + if <code>val</code> is not the correct type + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> param1 = assert_arg(<span class="number">1</span>,<span class="string">"hello"</span>,<span class="string">'table'</span>) <span class="comment">--> error: argument 1 expected a 'table', got a 'string' +</span><span class="keyword">local</span> param4 = assert_arg(<span class="number">4</span>,<span class="string">'!@#$%^&*'</span>,<span class="string">'string'</span>,path.isdir,<span class="string">'not a directory'</span>) + <span class="comment">--> error: argument 4: '!@#$%^&*' not a directory</span></pre> + </ul> + +</dd> + <dt> + <a name = "function_arg"></a> + <strong>function_arg (idx, f, msg)</strong> + </dt> + <dd> + process a function argument. + This is used throughout Penlight and defines what is meant by a function: + Something that is callable, or an operator string as defined by <code>pl.operator</code>, + such as '>' or '#'. If a function factory has been registered for the type, it will + be called to get the function. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">idx</span> + argument index + </li> + <li><span class="parameter">f</span> + a function, operator string, or callable object + </li> + <li><span class="parameter">msg</span> + optional error message + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a callable + </ol> + + <h3>Raises:</h3> + if idx is not a number or if f is not callable + + + +</dd> + <dt> + <a name = "assert_string"></a> + <strong>assert_string (n, val)</strong> + </dt> + <dd> + assert the common case that the argument is a string. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">n</span> + argument index + </li> + <li><span class="parameter">val</span> + a value that must be a string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + the validated value + </ol> + + <h3>Raises:</h3> + val must be a string + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> val = <span class="number">42</span> +<span class="keyword">local</span> param2 = utils.assert_string(<span class="number">2</span>, val) <span class="comment">--> error: argument 2 expected a 'string', got a 'number'</span></pre> + </ul> + +</dd> + <dt> + <a name = "on_error"></a> + <strong>on_error (mode)</strong> + </dt> + <dd> + +<p>control the error strategy used by Penlight. + This is a global setting that controls how <a href="../libraries/pl.utils.html#raise">utils.raise</a> behaves:</p> + +<ul> + <li>'default': return <code>nil + error</code> (this is the default)</li> + <li>'error': throw a Lua error</li> + <li>'quit': exit the program</li> +</ul> + + + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">mode</span> + either 'default', 'quit' or 'error' + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#raise">utils.raise</a> + </ul> + + +</dd> + <dt> + <a name = "raise"></a> + <strong>raise (err)</strong> + </dt> + <dd> + used by Penlight functions to return errors. Its global behaviour is controlled + by <a href="../libraries/pl.utils.html#on_error">utils.on_error</a>. + To use this function you MUST use it in conjunction with <code>return</code>, since it might + return <code>nil + error</code>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">err</span> + the error string. + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#on_error">utils.on_error</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">if</span> some_condition <span class="keyword">then</span> + <span class="keyword">return</span> utils.raise(<span class="string">"some condition was not met"</span>) <span class="comment">-- MUST use 'return'! +</span><span class="keyword">end</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="File_handling"></a>File handling </h2> + + <dl class="function"> + <dt> + <a name = "readfile"></a> + <strong>readfile (filename, is_bin)</strong> + </dt> + <dd> + return the contents of a file as a string + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filename</span> + The file path + </li> + <li><span class="parameter">is_bin</span> + open in binary mode + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + file contents + </ol> + + + + +</dd> + <dt> + <a name = "writefile"></a> + <strong>writefile (filename, str, is_bin)</strong> + </dt> + <dd> + write a string to a file + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filename</span> + The file path + </li> + <li><span class="parameter">str</span> + The string + </li> + <li><span class="parameter">is_bin</span> + open in binary mode + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + true or nil</li> + <li> + error message</li> + </ol> + + <h3>Raises:</h3> + error if filename or str aren't strings + + + +</dd> + <dt> + <a name = "readlines"></a> + <strong>readlines (filename)</strong> + </dt> + <dd> + return the contents of a file as a list of lines + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">filename</span> + The file path + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + file contents as a table + </ol> + + <h3>Raises:</h3> + error if filename is not a string + + + +</dd> +</dl> + <h2 class="section-header "><a name="OS_functions"></a>OS functions </h2> + + <dl class="function"> + <dt> + <a name = "executeex"></a> + <strong>executeex (cmd, bin)</strong> + </dt> + <dd> + execute a shell command and return the output. + This function redirects the output to tempfiles and returns the content of those files. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">cmd</span> + a shell command + </li> + <li><span class="parameter">bin</span> + boolean, if true, read output as binary file + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + true if successful</li> + <li> + actual return code</li> + <li> + stdout output (string)</li> + <li> + errout output (string)</li> + </ol> + + + + +</dd> + <dt> + <a name = "quote_arg"></a> + <strong>quote_arg (argument)</strong> + </dt> + <dd> + Quote and escape an argument of a command. + Quotes a single (or list of) argument(s) of a command to be passed + to <a href="https://www.lua.org/manual/5.1/manual.html#pdf-os.execute">os.execute</a>, <code>pl.utils.execute</code> or <a href="../libraries/pl.utils.html#executeex">pl.utils.executeex</a>. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">argument</span> + (string or table/list) the argument to quote. If a list then + all arguments in the list will be returned as a single string quoted. + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + quoted and escaped argument. + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> options = utils.quote_arg { + <span class="string">"-lluacov"</span>, + <span class="string">"-e"</span>, + <span class="string">"utils = print(require('pl.utils')._VERSION"</span>, +} +<span class="comment">-- returns: -lluacov -e 'utils = print(require('\''pl.utils'\'')._VERSION'</span></pre> + </ul> + +</dd> + <dt> + <a name = "quit"></a> + <strong>quit ([code], msg, ...)</strong> + </dt> + <dd> + error out of this program gracefully. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">code</span> + The exit code, defaults to -<code>1</code> if omitted + (<em>optional</em>) + </li> + <li><span class="parameter">msg</span> + The exit message will be sent to <code>stderr</code> (will be formatted with the extra parameters) + </li> + <li><span class="parameter">...</span> + extra arguments for message's format' + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#fprintf">utils.fprintf</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">utils.quit(-<span class="number">1</span>, <span class="string">"Error '%s' happened"</span>, <span class="string">"42"</span>) +<span class="comment">-- is equivalent to +</span>utils.quit(<span class="string">"Error '%s' happened"</span>, <span class="string">"42"</span>) <span class="comment">--> Error '42' happened</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="String_functions"></a>String functions </h2> + + <dl class="function"> + <dt> + <a name = "escape"></a> + <strong>escape (s)</strong> + </dt> + <dd> + escape any Lua 'magic' characters in a string + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + The input string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "split"></a> + <strong>split (s, re, plain, n)</strong> + </dt> + <dd> + split a string into a list of strings separated by a delimiter. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + The input string + </li> + <li><span class="parameter">re</span> + optional A Lua string pattern; defaults to '%s+' + </li> + <li><span class="parameter">plain</span> + optional If truthy don't use Lua patterns + </li> + <li><span class="parameter">n</span> + optional maximum number of elements (if there are more, the last will remian un-split) + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list-like table + </ol> + + <h3>Raises:</h3> + error if s is not a string + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#splitv">splitv</a> + </ul> + + +</dd> + <dt> + <a name = "splitv"></a> + <strong>splitv (s, re, plain, n)</strong> + </dt> + <dd> + split a string into a number of return values. + Identical to <a href="../libraries/pl.utils.html#split">split</a> but returns multiple sub-strings instead of + a single list of sub-strings. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the string + </li> + <li><span class="parameter">re</span> + A Lua string pattern; defaults to '%s+' + </li> + <li><span class="parameter">plain</span> + don't use Lua patterns + </li> + <li><span class="parameter">n</span> + optional maximum number of splits + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + n values + </ol> + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#split">split</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">first,<span class="global">next</span> = splitv(<span class="string">'user=jane=doe'</span>,<span class="string">'='</span>, <span class="keyword">false</span>, <span class="number">2</span>) +<span class="global">assert</span>(first == <span class="string">"user"</span>) +<span class="global">assert</span>(<span class="global">next</span> == <span class="string">"jane=doe"</span>)</pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Functional"></a>Functional </h2> + + <dl class="function"> + <dt> + <a name = "memoize"></a> + <strong>memoize (func)</strong> + </dt> + <dd> + 'memoize' a function (cache returned value for next call). + This is useful if you have a function which is relatively expensive, + but you don't know in advance what values will be required, so + building a table upfront is wasteful/impossible. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">func</span> + a function of at least one argument + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function with at least one argument, which is used as the key. + </ol> + + + + +</dd> + <dt> + <a name = "add_function_factory"></a> + <strong>add_function_factory (mt, fun)</strong> + </dt> + <dd> + associate a function factory with a type. + A function factory takes an object of the given type and + returns a function for evaluating it + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">mt</span> + <span class="types"><span class="type">tab</span></span> + metatable + </li> + <li><span class="parameter">fun</span> + <span class="types"><span class="type">func</span></span> + a callable that returns a function + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "string_lambda"></a> + <strong>string_lambda (lf)</strong> + </dt> + <dd> + an anonymous function as a string. This string is either of the form + '|args| expression' or is a function of one argument, '_' + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">lf</span> + function as a string + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function + </ol> + + + + <h3>Usage:</h3> + <ul> + <pre class="example">string_lambda <span class="string">'|x|x+1'</span> (<span class="number">2</span>) == <span class="number">3</span> +string_lambda <span class="string">'_+1'</span> (<span class="number">2</span>) == <span class="number">3</span></pre> + </ul> + +</dd> + <dt> + <a name = "bind1"></a> + <strong>bind1 (fn, p)</strong> + </dt> + <dd> + bind the first argument of the function to a value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + a function of at least two values (may be an operator string) + </li> + <li><span class="parameter">p</span> + a value + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function such that f(x) is fn(p,x) + </ol> + + <h3>Raises:</h3> + same as <a href="../libraries/pl.utils.html#function_arg">function_arg</a> + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.func.html#bind1">func.bind1</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> f(msg, name) + <span class="global">print</span>(msg .. <span class="string">" "</span> .. name) +<span class="keyword">end</span> + +<span class="keyword">local</span> hello = utils.bind1(f, <span class="string">"Hello"</span>) + +<span class="global">print</span>(hello(<span class="string">"world"</span>)) <span class="comment">--> "Hello world" +</span><span class="global">print</span>(hello(<span class="string">"sunshine"</span>)) <span class="comment">--> "Hello sunshine"</span></pre> + </ul> + +</dd> + <dt> + <a name = "bind2"></a> + <strong>bind2 (fn, p)</strong> + </dt> + <dd> + bind the second argument of the function to a value. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">fn</span> + a function of at least two values (may be an operator string) + </li> + <li><span class="parameter">p</span> + a value + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a function such that f(x) is fn(x,p) + </ol> + + <h3>Raises:</h3> + same as <a href="../libraries/pl.utils.html#function_arg">function_arg</a> + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> <span class="keyword">function</span> f(a, b, c) + <span class="global">print</span>(a .. <span class="string">" "</span> .. b .. <span class="string">" "</span> .. c) +<span class="keyword">end</span> + +<span class="keyword">local</span> hello = utils.bind1(f, <span class="string">"world"</span>) + +<span class="global">print</span>(hello(<span class="string">"Hello"</span>, <span class="string">"!"</span>)) <span class="comment">--> "Hello world !" +</span><span class="global">print</span>(hello(<span class="string">"Bye"</span>, <span class="string">"?"</span>)) <span class="comment">--> "Bye world ?"</span></pre> + </ul> + +</dd> +</dl> + <h2 class="section-header "><a name="Deprecation"></a>Deprecation </h2> + + <dl class="function"> + <dt> + <a name = "set_deprecation_func"></a> + <strong>set_deprecation_func (func)</strong> + </dt> + <dd> + Sets a deprecation warning function. + An application can override this function to support proper output of + deprecation warnings. The warnings can be generated from libraries or + functions by calling <a href="../libraries/pl.utils.html#raise_deprecation">utils.raise_deprecation</a>. The default function + will write to the 'warn' system (introduced in Lua 5.4, or the compatibility + function from the <a href="../libraries/pl.compat.html">compat</a> module for earlier versions).</p> + +<p> Note: only applications should set/change this function, libraries should not. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">func</span> + a callback with signature: <code>function(msg, trace)</code> both arguments are strings, the latter being optional. + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#raise_deprecation">utils.raise_deprecation</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="comment">-- write to the Nginx logs with OpenResty +</span>utils.set_deprecation_func(<span class="keyword">function</span>(msg, trace) + ngx.log(ngx.WARN, msg, (trace <span class="keyword">and</span> (<span class="string">" "</span> .. trace) <span class="keyword">or</span> <span class="keyword">nil</span>)) +<span class="keyword">end</span>) + +<span class="comment">-- disable deprecation warnings +</span>utils.set_deprecation_func()</pre> + </ul> + +</dd> + <dt> + <a name = "raise_deprecation"></a> + <strong>raise_deprecation (opts)</strong> + </dt> + <dd> + raises a deprecation warning. + For options see the usage example below.</p> + +<p> Note: the <code>opts.deprecated_after</code> field is the last version in which + a feature or option was NOT YET deprecated! Because when writing the code it + is quite often not known in what version the code will land. But the last + released version is usually known. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">opts</span> + options table + </li> + </ul> + + + + <h3>See also:</h3> + <ul> + <a href="../libraries/pl.utils.html#set_deprecation_func">utils.set_deprecation_func</a> + </ul> + + <h3>Usage:</h3> + <ul> + <pre class="example">warn(<span class="string">"@on"</span>) <span class="comment">-- enable Lua warnings, they are usually off by default +</span> +<span class="keyword">function</span> stringx.islower(str) + raise_deprecation { + source = <span class="string">"Penlight "</span> .. utils._VERSION, <span class="comment">-- optional +</span> message = <span class="string">"function 'islower' was renamed to 'is_lower'"</span>, <span class="comment">-- required +</span> version_removed = <span class="string">"2.0.0"</span>, <span class="comment">-- optional +</span> deprecated_after = <span class="string">"1.2.3"</span>, <span class="comment">-- optional +</span> no_trace = <span class="keyword">true</span>, <span class="comment">-- optional +</span> } + <span class="keyword">return</span> stringx.is_lower(str) +<span class="keyword">end</span> +<span class="comment">-- output: "[Penlight 1.9.2] function 'islower' was renamed to 'is_lower' (deprecated after 1.2.3, scheduled for removal in 2.0.0)"</span></pre> + </ul> + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> diff --git a/Data/Libraries/Penlight/docs/libraries/pl.xml.html b/Data/Libraries/Penlight/docs/libraries/pl.xml.html new file mode 100644 index 0000000..fb280ab --- /dev/null +++ b/Data/Libraries/Penlight/docs/libraries/pl.xml.html @@ -0,0 +1,835 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> +<head> + <title>Penlight Documentation</title> + <link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" /> +</head> +<body> + +<div id="container"> + +<div id="product"> + <div id="product_logo"></div> + <div id="product_name"><big><b></b></big></div> + <div id="product_description"></div> +</div> <!-- id="product" --> + + +<div id="main"> + + +<!-- Menu --> + +<div id="navigation"> +<br/> +<h1>Penlight</h1> + +<ul> + <li><a href="https://github.com/lunarmodules/Penlight">GitHub Project</a></li> + <li><a href="../index.html">Documentation</a></li> +</ul> + +<h2>Contents</h2> +<ul> +<li><a href="#Functions">Functions</a></li> +</ul> + + +<h2>Libraries</h2> +<ul class="nowrap"> + <li><a href="../libraries/pl.html">pl</a></li> + <li><a href="../libraries/pl.app.html">pl.app</a></li> + <li><a href="../libraries/pl.array2d.html">pl.array2d</a></li> + <li><a href="../libraries/pl.class.html">pl.class</a></li> + <li><a href="../libraries/pl.compat.html">pl.compat</a></li> + <li><a href="../libraries/pl.comprehension.html">pl.comprehension</a></li> + <li><a href="../libraries/pl.config.html">pl.config</a></li> + <li><a href="../libraries/pl.data.html">pl.data</a></li> + <li><a href="../libraries/pl.dir.html">pl.dir</a></li> + <li><a href="../libraries/pl.file.html">pl.file</a></li> + <li><a href="../libraries/pl.func.html">pl.func</a></li> + <li><a href="../libraries/pl.import_into.html">pl.import_into</a></li> + <li><a href="../libraries/pl.input.html">pl.input</a></li> + <li><a href="../libraries/pl.lapp.html">pl.lapp</a></li> + <li><a href="../libraries/pl.lexer.html">pl.lexer</a></li> + <li><a href="../libraries/pl.luabalanced.html">pl.luabalanced</a></li> + <li><a href="../libraries/pl.operator.html">pl.operator</a></li> + <li><a href="../libraries/pl.path.html">pl.path</a></li> + <li><a href="../libraries/pl.permute.html">pl.permute</a></li> + <li><a href="../libraries/pl.pretty.html">pl.pretty</a></li> + <li><a href="../libraries/pl.seq.html">pl.seq</a></li> + <li><a href="../libraries/pl.sip.html">pl.sip</a></li> + <li><a href="../libraries/pl.strict.html">pl.strict</a></li> + <li><a href="../libraries/pl.stringio.html">pl.stringio</a></li> + <li><a href="../libraries/pl.stringx.html">pl.stringx</a></li> + <li><a href="../libraries/pl.tablex.html">pl.tablex</a></li> + <li><a href="../libraries/pl.template.html">pl.template</a></li> + <li><a href="../libraries/pl.test.html">pl.test</a></li> + <li><a href="../libraries/pl.text.html">pl.text</a></li> + <li><a href="../libraries/pl.types.html">pl.types</a></li> + <li><a href="../libraries/pl.url.html">pl.url</a></li> + <li><a href="../libraries/pl.utils.html">pl.utils</a></li> + <li><strong>pl.xml</strong></li> +</ul> +<h2>Classes</h2> +<ul class="nowrap"> + <li><a href="../classes/pl.Date.html">pl.Date</a></li> + <li><a href="../classes/pl.List.html">pl.List</a></li> + <li><a href="../classes/pl.Map.html">pl.Map</a></li> + <li><a href="../classes/pl.MultiMap.html">pl.MultiMap</a></li> + <li><a href="../classes/pl.OrderedMap.html">pl.OrderedMap</a></li> + <li><a href="../classes/pl.Set.html">pl.Set</a></li> +</ul> +<h2>Manual</h2> +<ul class="nowrap"> + <li><a href="../manual/01-introduction.md.html">Introduction</a></li> + <li><a href="../manual/02-arrays.md.html">Tables and Arrays</a></li> + <li><a href="../manual/03-strings.md.html">Strings. Higher-level operations on strings.</a></li> + <li><a href="../manual/04-paths.md.html">Paths and Directories</a></li> + <li><a href="../manual/05-dates.md.html">Date and Time</a></li> + <li><a href="../manual/06-data.md.html">Data</a></li> + <li><a href="../manual/07-functional.md.html">Functional Programming</a></li> + <li><a href="../manual/08-additional.md.html">Additional Libraries</a></li> + <li><a href="../manual/09-discussion.md.html">Technical Choices</a></li> +</ul> +<h2>Examples</h2> +<ul class="nowrap"> + <li><a href="../examples/seesubst.lua.html">seesubst.lua</a></li> + <li><a href="../examples/sipscan.lua.html">sipscan.lua</a></li> + <li><a href="../examples/symbols.lua.html">symbols.lua</a></li> + <li><a href="../examples/test-cmp.lua.html">test-cmp.lua</a></li> + <li><a href="../examples/test-data.lua.html">test-data.lua</a></li> + <li><a href="../examples/test-listcallbacks.lua.html">test-listcallbacks.lua</a></li> + <li><a href="../examples/test-pretty.lua.html">test-pretty.lua</a></li> + <li><a href="../examples/test-symbols.lua.html">test-symbols.lua</a></li> + <li><a href="../examples/testclone.lua.html">testclone.lua</a></li> + <li><a href="../examples/testconfig.lua.html">testconfig.lua</a></li> + <li><a href="../examples/testglobal.lua.html">testglobal.lua</a></li> + <li><a href="../examples/testinputfields.lua.html">testinputfields.lua</a></li> + <li><a href="../examples/testinputfields2.lua.html">testinputfields2.lua</a></li> + <li><a href="../examples/testxml.lua.html">testxml.lua</a></li> + <li><a href="../examples/which.lua.html">which.lua</a></li> +</ul> + +</div> + +<div id="content"> + +<h1>Module <code>pl.xml</code></h1> +<p>XML LOM Utilities.</p> +<p> This implements some useful things on <a href="http://matthewwild.co.uk/projects/luaexpat/lom.html">LOM</a> documents, such as returned by <code>lxp.lom.parse</code>. + In particular, it can convert LOM back into XML text, with optional pretty-printing control. + It is s based on stanza.lua from <a href="http://hg.prosody.im/trunk/file/4621c92d2368/util/stanza.lua">Prosody</a></p> + + +<pre> +> d = xml.parse <span class="string">"<nodes><node id='1'>alice</node></nodes>"</span> +> = d +<nodes><node id=<span class="string">'1'</span>>alice</node></nodes> +> = xml.<span class="global">tostring</span>(d,<span class="string">''</span>,<span class="string">' '</span>) +<nodes> + <node id=<span class="string">'1'</span>>alice</node> +</nodes> +</pre> + +<p> Can be used as a lightweight one-stop-shop for simple XML processing; a simple XML parser is included + but the default is to use <code>lxp.lom</code> if it can be found. + <pre> + Prosody IM + Copyright (C) 2008-2010 Matthew Wild + Copyright (C) 2008-2010 Waqas Hussain-- + classic Lua XML parser by Roberto Ierusalimschy. + modified to output LOM format. + http://lua-users.org/wiki/LuaXml + </pre> + See <a href="../manual/06-data.md.html#XML">the Guide</a></p> + +<p> Dependencies: <a href="../libraries/pl.utils.html#">pl.utils</a></p> + +<p> Soft Dependencies: <code>lxp.lom</code> (fallback is to use basic Lua parser)</p> + + +<h2><a href="#Functions">Functions</a></h2> +<table class="function_list"> + <tr> + <td class="name" nowrap><a href="#new">new (tag, attr)</a></td> + <td class="summary">create a new document node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#parse">parse (text_or_file, is_file, use_basic)</a></td> + <td class="summary">parse an XML document.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:addtag">Doc:addtag (tag, attrs)</a></td> + <td class="summary">convenient function to add a document node, This updates the last inserted position.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:text">Doc:text (text)</a></td> + <td class="summary">convenient function to add a text node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:up">Doc:up ()</a></td> + <td class="summary">go up one level in a document</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:add_direct_child">Doc:add_direct_child (child)</a></td> + <td class="summary">append a child to a document directly.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:add_child">Doc:add_child (child)</a></td> + <td class="summary">append a child to a document at the last element added</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:set_attribs">Doc:set_attribs (t)</a></td> + <td class="summary">set attributes of a document node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:set_attrib">Doc:set_attrib (a, v)</a></td> + <td class="summary">set a single attribute of a document node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:get_attribs">Doc:get_attribs ()</a></td> + <td class="summary">access the attributes of a document node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#elem">elem (tag, items)</a></td> + <td class="summary">function to create an element with a given tag name and a set of children.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#tags">tags (list)</a></td> + <td class="summary">given a list of names, return a number of element constructors.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc.subst">Doc.subst (templ, data)</a></td> + <td class="summary">create a substituted copy of a document,</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:child_with_name">Doc:child_with_name (tag)</a></td> + <td class="summary">get the first child with a given tag name.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:get_elements_with_name">Doc:get_elements_with_name (tag, dont_recurse)</a></td> + <td class="summary">get all elements in a document that have a given tag.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:childtags">Doc:childtags ()</a></td> + <td class="summary">iterate over all child elements of a document node.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:maptags">Doc:maptags (callback)</a></td> + <td class="summary">visit child element of a node and call a function, possibility modifying the document.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#tostring">tostring (t, idn, indent, attr_indent, xml)</a></td> + <td class="summary">pretty-print an XML document</td> + </tr> + <tr> + <td class="name" nowrap><a href="#Doc:get_text">Doc:get_text ()</a></td> + <td class="summary">get the full text value of an element</td> + </tr> + <tr> + <td class="name" nowrap><a href="#clone">clone (doc, strsubst)</a></td> + <td class="summary">make a copy of a document</td> + </tr> + <tr> + <td class="name" nowrap><a href="#compare">compare (t1, t2)</a></td> + <td class="summary">compare two documents.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#is_tag">is_tag (d)</a></td> + <td class="summary">is this value a document element?</td> + </tr> + <tr> + <td class="name" nowrap><a href="#walk">walk (doc, depth_first, operation)</a></td> + <td class="summary">call the desired function recursively over the document.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#parsehtml">parsehtml (s)</a></td> + <td class="summary">Parse a well-formed HTML file as a string.</td> + </tr> + <tr> + <td class="name" nowrap><a href="#basic_parse">basic_parse (s, all_text, html)</a></td> + <td class="summary">Parse a simple XML document using a pure Lua parser based on Robero Ierusalimschy's original version.</td> + </tr> +</table> + +<br/> +<br/> + + + <h2 class="section-header "><a name="Functions"></a>Functions</h2> + + <dl class="function"> + <dt> + <a name = "new"></a> + <strong>new (tag, attr)</strong> + </dt> + <dd> + create a new document node. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tag</span> + the tag name + </li> + <li><span class="parameter">attr</span> + optional attributes (table of name-value pairs) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "parse"></a> + <strong>parse (text_or_file, is_file, use_basic)</strong> + </dt> + <dd> + parse an XML document. By default, this uses lxp.lom.parse, but + falls back to basic<em>parse, or if use</em>basic is true + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">text_or_file</span> + file or string representation + </li> + <li><span class="parameter">is_file</span> + whether text<em>or</em>file is a file name or not + </li> + <li><span class="parameter">use_basic</span> + do a basic parse + </li> + </ul> + + <h3>Returns:</h3> + <ol> + <li> + a parsed LOM document with the document metatatables set</li> + <li> + nil, error the error can either be a file error or a parse error</li> + </ol> + + + + +</dd> + <dt> + <a name = "Doc:addtag"></a> + <strong>Doc:addtag (tag, attrs)</strong> + </dt> + <dd> + convenient function to add a document node, This updates the last inserted position. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tag</span> + a tag name + </li> + <li><span class="parameter">attrs</span> + optional set of attributes (name-string pairs) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:text"></a> + <strong>Doc:text (text)</strong> + </dt> + <dd> + convenient function to add a text node. This updates the last inserted position. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">text</span> + a string + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:up"></a> + <strong>Doc:up ()</strong> + </dt> + <dd> + go up one level in a document + + + + + + + +</dd> + <dt> + <a name = "Doc:add_direct_child"></a> + <strong>Doc:add_direct_child (child)</strong> + </dt> + <dd> + append a child to a document directly. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">child</span> + a child node (either text or a document) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:add_child"></a> + <strong>Doc:add_child (child)</strong> + </dt> + <dd> + append a child to a document at the last element added + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">child</span> + a child node (either text or a document) + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:set_attribs"></a> + <strong>Doc:set_attribs (t)</strong> + </dt> + <dd> + set attributes of a document node. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + a table containing attribute/value pairs + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:set_attrib"></a> + <strong>Doc:set_attrib (a, v)</strong> + </dt> + <dd> + set a single attribute of a document node. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">a</span> + attribute + </li> + <li><span class="parameter">v</span> + its value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:get_attribs"></a> + <strong>Doc:get_attribs ()</strong> + </dt> + <dd> + access the attributes of a document node. + + + + + + + +</dd> + <dt> + <a name = "elem"></a> + <strong>elem (tag, items)</strong> + </dt> + <dd> + function to create an element with a given tag name and a set of children. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tag</span> + a tag name + </li> + <li><span class="parameter">items</span> + either text or a table where the hash part is the attributes and the list part is the children. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "tags"></a> + <strong>tags (list)</strong> + </dt> + <dd> + given a list of names, return a number of element constructors. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">list</span> + a list of names, or a comma-separated string. + </li> + </ul> + + + + + <h3>Usage:</h3> + <ul> + <pre class="example"><span class="keyword">local</span> parent,children = doc.tags <span class="string">'parent,children'</span> <br> + doc = parent {child <span class="string">'one'</span>, child <span class="string">'two'</span>}</pre> + </ul> + +</dd> + <dt> + <a name = "Doc.subst"></a> + <strong>Doc.subst (templ, data)</strong> + </dt> + <dd> + create a substituted copy of a document, + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">templ</span> + may be a document or a string representation which will be parsed and cached + </li> + <li><span class="parameter">data</span> + a table of name-value pairs or a list of such tables + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + an XML document + </ol> + + + + +</dd> + <dt> + <a name = "Doc:child_with_name"></a> + <strong>Doc:child_with_name (tag)</strong> + </dt> + <dd> + get the first child with a given tag name. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tag</span> + the tag name + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "Doc:get_elements_with_name"></a> + <strong>Doc:get_elements_with_name (tag, dont_recurse)</strong> + </dt> + <dd> + get all elements in a document that have a given tag. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">tag</span> + a tag name + </li> + <li><span class="parameter">dont_recurse</span> + optionally only return the immediate children with this tag name + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a list of elements + </ol> + + + + +</dd> + <dt> + <a name = "Doc:childtags"></a> + <strong>Doc:childtags ()</strong> + </dt> + <dd> + iterate over all child elements of a document node. + + + + + + + +</dd> + <dt> + <a name = "Doc:maptags"></a> + <strong>Doc:maptags (callback)</strong> + </dt> + <dd> + visit child element of a node and call a function, possibility modifying the document. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">callback</span> + a function passed the node (text or element). If it returns nil, that node will be removed. + If it returns a value, that will replace the current node. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "tostring"></a> + <strong>tostring (t, idn, indent, attr_indent, xml)</strong> + </dt> + <dd> + pretty-print an XML document + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t</span> + an XML document + </li> + <li><span class="parameter">idn</span> + an initial indent (indents are all strings) + </li> + <li><span class="parameter">indent</span> + an indent for each level + </li> + <li><span class="parameter">attr_indent</span> + if given, indent each attribute pair and put on a separate line + </li> + <li><span class="parameter">xml</span> + force prefacing with default or custom <?xml...> + </li> + </ul> + + <h3>Returns:</h3> + <ol> + + a string representation + </ol> + + + + +</dd> + <dt> + <a name = "Doc:get_text"></a> + <strong>Doc:get_text ()</strong> + </dt> + <dd> + get the full text value of an element + + + + + + + +</dd> + <dt> + <a name = "clone"></a> + <strong>clone (doc, strsubst)</strong> + </dt> + <dd> + make a copy of a document + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">doc</span> + the original document + </li> + <li><span class="parameter">strsubst</span> + an optional function for handling string copying which could do substitution, etc. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "compare"></a> + <strong>compare (t1, t2)</strong> + </dt> + <dd> + compare two documents. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">t1</span> + any value + </li> + <li><span class="parameter">t2</span> + any value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "is_tag"></a> + <strong>is_tag (d)</strong> + </dt> + <dd> + is this value a document element? + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">d</span> + any value + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "walk"></a> + <strong>walk (doc, depth_first, operation)</strong> + </dt> + <dd> + call the desired function recursively over the document. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">doc</span> + the document + </li> + <li><span class="parameter">depth_first</span> + visit child notes first, then the current node + </li> + <li><span class="parameter">operation</span> + a function which will receive the current tag name and current node. + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "parsehtml"></a> + <strong>parsehtml (s)</strong> + </dt> + <dd> + Parse a well-formed HTML file as a string. + Tags are case-insenstive, DOCTYPE is ignored, and empty elements can be .. empty. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the HTML + </li> + </ul> + + + + + +</dd> + <dt> + <a name = "basic_parse"></a> + <strong>basic_parse (s, all_text, html)</strong> + </dt> + <dd> + Parse a simple XML document using a pure Lua parser based on Robero Ierusalimschy's original version. + + + <h3>Parameters:</h3> + <ul> + <li><span class="parameter">s</span> + the XML document to be parsed. + </li> + <li><span class="parameter">all_text</span> + if true, preserves all whitespace. Otherwise only text containing non-whitespace is included. + </li> + <li><span class="parameter">html</span> + if true, uses relaxed HTML rules for parsing + </li> + </ul> + + + + + +</dd> +</dl> + + +</div> <!-- id="content" --> +</div> <!-- id="main" --> +<div id="about"> +<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> +</div> <!-- id="about" --> +</div> <!-- id="container" --> +</body> +</html> |