diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-12 15:28:58 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-12 15:28:58 -0700 |
| commit | 6e236fa0957ef0c0d138b372fee736a6ea3302dd (patch) | |
| tree | ec77b23ba80324e27f272705cc85d40cb0a7c8a8 /utils.moon | |
| parent | c26db225f3d27d3cea6353246d816b02ff4f2900 (diff) | |
Tweaks and fixes.
Diffstat (limited to 'utils.moon')
| -rw-r--r-- | utils.moon | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -18,14 +18,18 @@ utils = { if not add_quotes x elseif not x\find[["]] and not x\find"\n" - "\"#{x}\"" + "\""..x.."\"" elseif not x\find[[']] and not x\find"\n" - "\'#{x}\'" + "\'"..x.."\'" else for i=0,math.huge eq = ("=")\rep(i) if not x\find"%[#{eq}%[" and not x\find"%]#{eq}%]" - return "[#{eq}[#{x}]#{eq}]" + -- Stupid bullshit add an extra newline because lua discards first one if it exists + if x\sub(1,1) == "\n" + return "[#{eq}[\n"..x.."]#{eq}]" + else + return "[#{eq}["..x.."]#{eq}]" else tostring(x) @@ -47,7 +51,7 @@ utils = { return setmetatable({:start,:stop,:step}, { __ipairs: => iter = (i)=> - if i < (@stop-@start)/@step + if i <= (@stop-@start)/@step return i+1, @start+i*@step return iter, @, 0 }) |
