summaryrefslogtreecommitdiffhomepage
path: root/libs/json
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-27 17:49:52 +0000
committerSteven Barth <steven@midlink.org>2008-08-27 17:49:52 +0000
commit9a8eb7fce6bc02fea83bda0e355a4d001b825671 (patch)
treeeff909fced61cbba59716365680e7875bedd4e90 /libs/json
parenta4761ed42f73c928f9ce573ed35de9a246a64eb9 (diff)
Rewrote the API-documentation for luci.json
Diffstat (limited to 'libs/json')
-rw-r--r--libs/json/luasrc/json.lua23
1 files changed, 15 insertions, 8 deletions
diff --git a/libs/json/luasrc/json.lua b/libs/json/luasrc/json.lua
index 3d6a576a8..3f66b8332 100644
--- a/libs/json/luasrc/json.lua
+++ b/libs/json/luasrc/json.lua
@@ -55,6 +55,7 @@ local next = next
local getmetatable = getmetatable
+--- LuCI JSON-Library
module "luci.json"
--- Null replacement function
@@ -63,12 +64,15 @@ function null()
return null
end
-
+--- JSON-Encoder
+-- @class module
+-- @cstyle instance
+-- @name luci.json.Encoder
Encoder = util.class()
--- Creates a new Encoder.
--- @param data Data to be encoded.
--- @param buffersize Buffersize of returned data.
+-- @param data Lua-Object to be encoded.
+-- @param buffersize Blocksize of returned data source.
-- @param fastescape Use non-standard escaping (don't escape control chars)
function Encoder.__init__(self, data, buffersize, fastescape)
self.data = data
@@ -79,7 +83,7 @@ function Encoder.__init__(self, data, buffersize, fastescape)
getmetatable(self).__call = Encoder.source
end
---- Create an LTN12 source from the encoder object
+--- Create an LTN12 source providing the encoded JSON-Data.
-- @return LTN12 source
function Encoder.source(self)
local source = coroutine.create(self.dispatch)
@@ -207,17 +211,20 @@ Encoder.parsers = {
}
-
+--- JSON-Decoder
+-- @class module
+-- @cstyle instance
+-- @name luci.json.Decoder
Decoder = util.class()
--- Create a new Decoder object.
--- @param customnull User luci.json.null instead of nil
+-- @param customnull Use luci.json.null instead of nil
function Decoder.__init__(self, customnull)
self.cnull = customnull
getmetatable(self).__call = Decoder.sink
end
---- Create an LTN12 sink from the decoder object.
+--- Create an LTN12 sink from the decoder object which accepts the JSON-Data.
-- @return LTN12 sink
function Decoder.sink(self)
local sink = coroutine.create(self.dispatch)
@@ -227,7 +234,7 @@ function Decoder.sink(self)
end
---- Get the decoded data packets
+--- Get the decoded data packets after the rawdata has been sent to the sink.
-- @return Decoded data
function Decoder.get(self)
return self.data