Documentation for this module may be created at Module:Sandbox/Flarn2006/circle/doc
local p = {}
function p.circle(frame)
local output = '<pre>\n'
local r = tonumber(frame.args[1]) / 2
for i=-r,r do
local y = i/r
for j=-r,r do
local x = j/r
if x*x + y*y > 1 then
output = output..' '
else
output = output..'()'
end
end
output = output..'\n'
end
output = output..'</pre>'
return output
end
function p.circles(frame)
local start_diameter = tonumber(frame.args[1])
local end_diameter = tonumber(frame.args[2])
local step = tonumber(frame.args[3] or 1)
local output = ''
for d=start_diameter,end_diameter,step do
output = output..'<math>d='..tostring(d)..'</math>'
output = output..p.circle({args={d}})
end
return output
end
return p