Hi, I’m new in lua/codea programming but I now bases of other programming languages.
So I tried to learn with this tutorial : http://codeatuts.blogspot.com.au/ but at the second part of the tutorial, I don’t understand .
He asked us to copy and paste a part of code and then he is explaining it but I don’t understand.
I’ll copy this code and write with comments what I don’t understand :
function roundRect(x,y,w,h,r)
pushStyle()
-- until there, I understand all
insetPos = vec2(x+r,y+r)
insetSize = vec2(w-2*r,h-2*r)
-- I don't now why and how use vec2
--Copy fill into stroke
local red,green,blue,a = fill()
stroke(red,green,blue,a)
-- what is stroke ? And he don't explain what's a local variable ?
noSmooth()
rectMode(CORNER)
rect(insetPos.x,insetPos.y,insetSize.x,insetSize.y)
-- what's the function rectMode ?
if r > 0 then
smooth()
lineCapMode(ROUND)
strokeWidth(r*2)
line(insetPos.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y)
line(insetPos.x, insetPos.y,
insetPos.x, insetPos.y + insetSize.y)
line(insetPos.x, insetPos.y + insetSize.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
line(insetPos.x + insetSize.x, insetPos.y,
insetPos.x + insetSize.x, insetPos.y + insetSize.y)
-- I don't understand what are these functions line, how and why use them .
end
popStyle()
end
So, thank you very much to explain me this code.
I’ll use this discussion to asks questions about this tutorial if I don’t understand other parts of it .
PS : Sorry if my English isn’t perfect, I’m French .