Loops

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Batrachus
Prole
Posts: 7
Joined: Sat Apr 16, 2011 8:39 am
Location: Czech Republic

Loops

Post by Batrachus »

I was looking for loops on wiki, on forums and I didnt found anything. So I ask: Do in Löve exist loops? I mean for, while etc. Thanks for answers.
My arrowfish doesn't want to be in one picture with OBEY. So I putted it into my signature.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Loops

Post by bmelts »

Yes, they do. LÖVE uses Lua, which has loops built-in.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Loops

Post by BlackBulletIV »

As anjo said, LOVE uses Lua (a programming language). I recommend learning the fundamentals of it before starting out. Programming in Lua is how I learned Lua.
User avatar
Batrachus
Prole
Posts: 7
Joined: Sat Apr 16, 2011 8:39 am
Location: Czech Republic

Re: Loops

Post by Batrachus »

I found it. Thx, BlackBulletIV.

So, these are loops? I find it confusing. Im not wont to programm in this.

http://www.lua.org/pil/4.3.3.html - this is like do while?
http://www.lua.org/pil/4.3.2.html
http://www.lua.org/pil/4.3.4.html
http://www.lua.org/pil/4.3.5.html - this is like foreach?
Last edited by Batrachus on Sat Apr 16, 2011 9:21 am, edited 1 time in total.
My arrowfish doesn't want to be in one picture with OBEY. So I putted it into my signature.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Loops

Post by BlackBulletIV »

Yes those are loops. You'll get used to it :).

4.3.3 is like:

Code: Select all

do
{
  // ...
} while !condition;
4.3.2 is obvious.

4.3.4 is like:

Code: Select all

for (double i = start; i <= end; i += countBy)
4.3.5 works off iterator functions. Read up on iterators to learn more. So it's closest relative in the Cish languages is foreach.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Loops

Post by kikito »

On my love tile tutorial I have a section speaking about loops. I'll leave it here in case it is useful.
When I write def I mean function.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 56 guests