diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-12-17 02:36:45 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-12-17 02:36:45 +0100 |
commit | e19098d0623e96690e65539b36c59965ae1373d5 (patch) | |
tree | d119b6321ece019fbedc711c13bf0b28e85a1055 /libs/luci-lib-jsonc/src/jsonc.luadoc | |
parent | 31816e92f109e0c534f176ca1e79b032917c876c (diff) | |
parent | 5335f225374c7ed993348d15b5018411dc776bab (diff) |
Merge pull request #462 from jplitza/jsonc-sink
luci-lib-jsonc: Add ltn12-compatible sink factory
Diffstat (limited to 'libs/luci-lib-jsonc/src/jsonc.luadoc')
-rw-r--r-- | libs/luci-lib-jsonc/src/jsonc.luadoc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libs/luci-lib-jsonc/src/jsonc.luadoc b/libs/luci-lib-jsonc/src/jsonc.luadoc index 2ee9cebdc8..720b17d1eb 100644 --- a/libs/luci-lib-jsonc/src/jsonc.luadoc +++ b/libs/luci-lib-jsonc/src/jsonc.luadoc @@ -121,10 +121,22 @@ parser:set({ "some", "data" })` ]] ---[[ -Serialize current parser state as JSON. +Generate an ltn12-compatible sink. @class function @sort 4 +@name parser.sink +@return Returns a function that can be used as an ltn12 sink. +@usage `parser = luci.jsonc.new() +ltn12.pump.all(ltn12.source.file(io.input()), parser:sink()) +print(parser:get())` +]] + +---[[ +Serialize current parser state as JSON. + +@class function +@sort 5 @name parser.stringify @param pretty A boolean value indicating whether the resulting JSON should be pretty printed. @return Returns the serialized JSON data of this parser instance. |