I can't seem to find a way to check wether a number is odd or even. I've tried with type() (which just gives 'number') and string.find(tostring(number), "."). String.find didn't prove very helpful, despite being my best bet. :/ I tried escaping the dot (is it in regexp format?) but it didn't work either. Anyone got any suggestions as to how I could do this?
The purpose is to get this function to output a centered text:
The purpose is to get this function to output a centered text:
function visLine(msg, color)
lnum, rnum = (74 - string.len(msg)) / 2, (74 - string.len(msg)) / 2
if not string.find(tostring(lnum), "\.") == false then rnum = lnum + 2 end
ColourTell("lightgrey", "", string.rep("-",lnum) .. " [ ")
ColourTell(color, "", msg)
ColourNote("lightgrey", "", " ] " .. string.rep("-",rnum))
end