summaryrefslogtreecommitdiffhomepage
path: root/documentation/api
diff options
context:
space:
mode:
authorJan-Philipp Litza <janphilipp@litza.de>2015-09-01 16:17:23 +0200
committerJan-Philipp Litza <janphilipp@litza.de>2015-09-04 12:21:30 +0200
commit5335f225374c7ed993348d15b5018411dc776bab (patch)
tree1a09ce68eac08178a96c162bb1f75528c398bb54 /documentation/api
parentf0083abed10e8a397ebe9e62801e3b5d536ba7b6 (diff)
luci-lib-jsonc: Add ltn12-compatible sink factory
To use the luci-lib-jsonc parser as sink for an ltn12 pump (for example from stdin), the following code will now do: require 'luci.ltn12' require 'luci.jsonc' local parser = luci.jsonc.new() luci.ltn12.pump.all(luci.ltn12.source.file(io.input()), parser:sink()) print(parser:get()) Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
Diffstat (limited to 'documentation/api')
-rw-r--r--documentation/api/modules/luci.jsonc.parser.html35
1 files changed, 35 insertions, 0 deletions
diff --git a/documentation/api/modules/luci.jsonc.parser.html b/documentation/api/modules/luci.jsonc.parser.html
index 4c19cf0e5..e8e145f43 100644
--- a/documentation/api/modules/luci.jsonc.parser.html
+++ b/documentation/api/modules/luci.jsonc.parser.html
@@ -234,6 +234,13 @@ Put Lua data into the parser.</td>
</tr>
<tr>
+ <td class="name" nowrap><a href="#parser.sink">parser:sink</a>&nbsp;()</td>
+ <td class="summary">
+
+Generate an ltn12-compatible sink.</td>
+ </tr>
+
+ <tr>
<td class="name" nowrap><a href="#parser.stringify">parser:stringify</a>&nbsp;(pretty)</td>
<td class="summary">
@@ -406,6 +413,34 @@ Nothing is returned.
+<dt><a name="parser.sink"></a><strong>parser:sink</strong>&nbsp;()</dt>
+<dd>
+
+
+Generate an ltn12-compatible sink.
+
+
+
+
+
+
+<h3>Usage:</h3>
+<pre>parser = luci.jsonc.new()
+ltn12.pump.all(ltn12.source.file(io.input()), parser:sink())
+print(parser:get())</pre>
+
+
+
+<h3>Return value:</h3>
+Returns a function that can be used as an ltn12 sink.
+
+
+
+</dd>
+
+
+
+
<dt><a name="parser.stringify"></a><strong>parser:stringify</strong>&nbsp;(pretty)</dt>
<dd>