aboutsummaryrefslogtreecommitdiff
path: root/nomsu.lua
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-04-08 16:06:31 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-04-08 16:06:39 -0700
commit4e51768ebdf98c0da545c6598b3d6e9af6c04409 (patch)
tree64161dec44a88cc719060d52d80579a237f04033 /nomsu.lua
parent680006b25ac9d6f0c25b5a35374a33c6047b21c1 (diff)
Improved codegen code.
Diffstat (limited to 'nomsu.lua')
-rw-r--r--nomsu.lua6
1 files changed, 5 insertions, 1 deletions
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