libs/json: Fix a typo and a logic error in json.lua to make luci.json.encode() work like expected (#220)
This commit is contained in:
parent
3a12f82014
commit
fdf625ea67
1 changed files with 2 additions and 2 deletions
|
@ -82,7 +82,7 @@ function encode(obj, ...)
|
||||||
repeat
|
repeat
|
||||||
chnk, err = e()
|
chnk, err = e()
|
||||||
out[#out+1] = chnk
|
out[#out+1] = chnk
|
||||||
until chnk
|
until not chnk
|
||||||
return not err and table.concat(out) or nil
|
return not err and table.concat(out) or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ end
|
||||||
|
|
||||||
function Encoder.put(self, chunk)
|
function Encoder.put(self, chunk)
|
||||||
if self.buffersize < 2 then
|
if self.buffersize < 2 then
|
||||||
corountine.yield(chunk)
|
coroutine.yield(chunk)
|
||||||
else
|
else
|
||||||
if #self.buffer + #chunk > self.buffersize then
|
if #self.buffer + #chunk > self.buffersize then
|
||||||
local written = 0
|
local written = 0
|
||||||
|
|
Loading…
Reference in a new issue