diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-07 19:28:07 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-07 19:28:07 +0000 |
commit | 9663c7cf2e56c59db2888caae25098d32ef91bcd (patch) | |
tree | 5e42bec258eaecbeefe569b74f96b38a9715f3c0 /modules/admin-full/luasrc | |
parent | 561673c0a12c5d3371efb8c4f64cc60e8fb89682 (diff) |
modules/admin-full: switch to luci.http.write_json()
Diffstat (limited to 'modules/admin-full/luasrc')
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/network.lua | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 950285d588..9492e11d77 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -162,39 +162,6 @@ function wifi_delete(network) luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless")) end -function jsondump(x) - if x == nil then - luci.http.write("null") - elseif type(x) == "table" then - local k, v - if type(next(x)) == "number" then - luci.http.write("[ ") - for k, v in ipairs(x) do - jsondump(v) - if next(x, k) then - luci.http.write(", ") - end - end - luci.http.write(" ]") - else - luci.http.write("{ ") - for k, v in pairs(x) do - luci.http.write("%q: " % k) - jsondump(v) - if next(x, k) then - luci.http.write(", ") - end - end - luci.http.write(" }") - end - elseif type(x) == "number" or type(x) == "boolean" then - luci.http.write(tostring(x)) - elseif type(x) == "string" then - luci.http.write("%q" % tostring(x)) - end -end - - function iface_status() local path = luci.dispatcher.context.requestpath local x = luci.model.uci.cursor_state() @@ -245,7 +212,7 @@ function iface_status() if #rv > 0 then luci.http.prepare_content("application/json") - jsondump(rv) + luci.http.write_json(rv) return end @@ -276,7 +243,7 @@ function wifi_status() if #rv > 0 then luci.http.prepare_content("application/json") - jsondump(rv) + luci.http.write_json(rv) return end |