Code: Select all
function Stat1exp()
for i = 1, 4, 1 do
party.party:getChampion(i):gainExp(150)
hudPrint("Gained 150 Xp.")
end
endCode: Select all
function Stat1exp()
for i = 1, 4, 1 do
party.party:getChampion(i):gainExp(150)
hudPrint("Gained 150 Xp.")
end
endCode: Select all
function Stat1exp()
for i = 1, 4, 1 do
party.party:getChampion(i):gainExp(150)
end
hudPrint("Gained 150 Xp.")
end
A silly ask, I suppose, but why "for i = 1, 4, 1 do" and not simply "for i=1,4 do"??Azel wrote:tada!Code: Select all
function Stat1exp() for i = 1, 4, 1 do party.party:getChampion(i):gainExp(150) end hudPrint("Gained 150 Xp.") end
OK I see, thanksAzel wrote:That last "1" is just the step increment. In this case we could have left it out and the loop would default to incrementing by 1, so you're right about not really needing it here. I left it in the example so that I wasn't changing too much from the original code.
Code: Select all
for counter = 1,4,1 do
print(counter);
end
Code: Select all
local counter = 1
while counter <= 4 do
print(counter)
counter = counter + 1;
end
Code: Select all
for counter = 1,4,2 do
print(counter);
end
Code: Select all
for counter = 1,4,3 do
print(counter);
end
Code: Select all
for counter = 1,4,4 do
print(counter);
end