diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 17:48:35 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-09 17:48:52 -0800 |
| commit | b2cec10592b0b3fcd6c8da04fcce709fbf2e5a5e (patch) | |
| tree | 2c41a0bed73e1bc23ff436454f43a3c767c5abf9 | |
| parent | 6fa1cb23d151463b7d85dcf9d5c413420d11ecad (diff) | |
Fixed `'s` clumping for stuff like (%foo's metatable)
| -rw-r--r-- | nomsu_decompiler.lua | 7 | ||||
| -rw-r--r-- | nomsu_decompiler.moon | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/nomsu_decompiler.lua b/nomsu_decompiler.lua index 9ff62b1..21facdc 100644 --- a/nomsu_decompiler.lua +++ b/nomsu_decompiler.lua @@ -57,7 +57,12 @@ tree_to_inline_nomsu = function(tree) end for i, bit in ipairs(tree) do if type(bit) == "string" then - local clump_words = (type(tree[i - 1]) == 'string' and is_operator(bit) ~= is_operator(tree[i - 1])) + local clump_words + if type(tree[i - 1]) then + clump_words = is_operator(bit) ~= is_operator(tree[i - 1]) + else + clump_words = is_operator(bit) + end if i > 1 and not clump_words then nomsu:append(" ") end diff --git a/nomsu_decompiler.moon b/nomsu_decompiler.moon index 0bc4805..b711112 100644 --- a/nomsu_decompiler.moon +++ b/nomsu_decompiler.moon @@ -40,7 +40,9 @@ tree_to_inline_nomsu = (tree)-> for i,bit in ipairs tree if type(bit) == "string" - clump_words = (type(tree[i-1]) == 'string' and is_operator(bit) != is_operator(tree[i-1])) + clump_words = if type(tree[i-1]) == 'string' + is_operator(bit) != is_operator(tree[i-1]) + else is_operator(bit) nomsu\append " " if i > 1 and not clump_words nomsu\append bit else |
