diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-18 01:49:13 -0800 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2018-01-18 01:49:27 -0800 |
| commit | f91d06d9fa567b26a098ff26a0339afdd5daa778 (patch) | |
| tree | 6899c345433629b05c5b51f6545ae7ba02a692e7 /utils.lua | |
| parent | 12cc294c7ac31e3d08d6b8924dfc6cc427a1f712 (diff) | |
Initial commit of object oriented classes.
Diffstat (limited to 'utils.lua')
| -rw-r--r-- | utils.lua | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -80,14 +80,15 @@ local function repr(x, depth) return "\"" .. x .. "\"" else local eq = ("="):rep(_quote_state.min_eq or 0) - -- Need to add parens around ([=[...]=]) so lua's parser doesn't get confused - -- by stuff like x[[=[...]=]], which should obviously parse as x[ ([=[...]=]) ], - -- but instead parses as x( [[=[...]=]] ), i.e. a function call whose argument - -- is a string that starts with "=[" and ends with "]=" + -- BEWARE!!! + -- Lua's parser and syntax are dumb, so Lua interprets x[[=[asdf]=]] as + -- a function call to x (i.e. x("=[asdf]=")), instead of indexing x + -- (i.e. x["asdf"]), which it obviously should be. This can be fixed by + -- slapping spaces or parens around the [=[asdf]=]. if x:sub(1, 1) == "\n" then - return "(["..eq.."[\n"..x.."]"..eq.."])" + return "["..eq.."[\n"..x.."]"..eq.."]" else - return "(["..eq.."["..x.."]"..eq.."])" + return "["..eq.."["..x.."]"..eq.."]" end end else |
