From 4e51768ebdf98c0da545c6598b3d6e9af6c04409 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 8 Apr 2018 16:06:31 -0700 Subject: Improved codegen code. --- nomsu.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nomsu.lua') diff --git a/nomsu.lua b/nomsu.lua index 6799c9c..dd0f54e 100644 --- a/nomsu.lua +++ b/nomsu.lua @@ -1201,7 +1201,11 @@ do if item.type == 'Text' and #item.value == 1 and type(item.value[1]) == 'string' and item.value[1]:match("^[a-zA-Z_][a-zA-Z0-9_]$") then insert(items, "." .. tostring(item.value[1])) else - insert(items, "[ " .. tostring(lua.expr) .. "]") + if lua.expr:sub(1, 1) == '[' then + insert(items, "[ " .. tostring(lua.expr) .. "]") + else + insert(items, "[" .. tostring(lua.expr) .. "]") + end end end end -- cgit v1.2.3