From 09203d201ececd5e887f6e33d2ec5117fdb27872 Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 12 Apr 2014 21:01:30 +0100 Subject: [PATCH] Added support for numerical table keys to env vars browser --- lovebird.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lovebird.lua b/lovebird.lua index d22996c..e7d4440 100644 --- a/lovebird.lua +++ b/lovebird.lua @@ -238,14 +238,15 @@ end var html = ""; for (var i = 0; json.vars[i]; i++) { var x = json.vars[i]; - var fullpath = (json.path + "." + x.key).replace(/^\./, ""); + var fullpath = (json.path + "." + x.key) .replace(/^\./, ""); var k = truncate(x.key, 15); if (x.type == "table") { k = "" + k + ""; } - var v = "" + - x.value + "" + var v = "" + x.value + "" html += ""; } html += "
" + k + "" + v + "
"; @@ -278,7 +279,7 @@ lovebird.pages["env.json"] = [[ p = p:gsub("%.+", "%."):match("^[%.]*(.*)[%.]*$") if p ~= "" then for x in p:gmatch("[^%.]+") do - t = t[x] + t = t[x] or t[tonumber(x)] -- Return early if path does not exist if type(t) ~= "table" then echo('{ "valid": false, "path": ' .. string.format("%q", p) .. ' }')