I want to print the WaveNumber such that is follows this order:
1
Next wave!
2
Next wave!
3
and so on…
Could anybody here help me? It would be much appreciated!
I want to print the WaveNumber such that is follows this order:
1
Next wave!
2
Next wave!
3
and so on…
Could anybody here help me? It would be much appreciated!
Your function returns a number. To print this, you would say:
print(WaveIncrease())
Since WaveIncrease is a function that returns a number, it will print the number!
Thanks to Benified4Life for pointing out that you have to have parentheses after a function for it to actually return a number! Thanks for the tip!
Just do
print(WaveNumber)
or if you want to print using the return:
WaveIncrease()
Hey there!
I don’t entirely understand what the usage case for this would be so any context would be appreciated. However, to answer your question you can simply use for i
loops and print the iteration you’re currently in!
Example:
for WaveNumber = 1, TimesYouWantToRepeatThis do
print(Iteration) --// This should print your current WaveNumber
print("Next Wave!")
end
I hate to nit pick, however doing WaveIncrease will just return the functions memory address as it’s being passed as a variable. You’ll have to do WaveIncrease() to get a number return.
Oh ok! That’s something new I have learnt! Thanks for the information!
Yes, thank you so much for your help!
I’m trying to make a wave counter for a base-defense game.
I’m very new to coding so I may not be familiar with for i
loops but it did help and I shall practice using that more often.