From 6e236fa0957ef0c0d138b372fee736a6ea3302dd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 12 Sep 2017 15:28:58 -0700 Subject: Tweaks and fixes. --- utils.moon | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'utils.moon') diff --git a/utils.moon b/utils.moon index a186d3c..7ba39bb 100644 --- a/utils.moon +++ b/utils.moon @@ -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 }) -- cgit v1.2.3