EDGE Community
FAQ  FAQ   Search  Search   Memberlist  Memberlist   Usergroups  EDGE Home
Register  ::  Log in Log in to check your private messages


Post new topic  Reply to topic
 Is it possible to use a "for" loop in COAL ? « View previous topic :: View next topic » 
Author Message
Agar
PostPosted: Tue 27 Oct 2009 1:10 am    Post subject: Is it possible to use a "for" loop in COAL ? Reply with quote



Joined: 27 Oct 2009
Posts: 18
Location: Paris, France

First, as this is my first post on these boards, I'd like to congratulate the EDGE team for the 1.34 release candidate. A great update to a great Doom port. Keep up the good work, guys !

Now to my problem :
Well... I think the title of the topic pretty much sums it all.

I'm designing a HUD for my project, and I positively, absolutely need to use a "for" loop to draw some elements.

I used to do it without any problem in LUA, but since the COAL scripting language has replaced it, it doesn't work anymore.

I tried a few syntaxes...
- The LUA one : "for var=x,y,z do something end"
- The C one : "for (var = x, var < y; var = var + z) { something }"

...and none of them works. Crying or Very sad

Maybe the ability to do a "for" loop hasn't been implemented yet ?
Or maybe I just don't know how to do it... Smile

Could somebody help me with this ?
Back to top
View user's profile Send private message Visit poster's website
andrewj
PostPosted: Tue 27 Oct 2009 4:19 am    Post subject: Reply with quote



Joined: 05 May 2007
Posts: 599
Location: Tasmania

Yes there is a for loop, but it is different from C or Lua:

Code:
for (x = 1,10)
{
  sys.print(x)
}


It doesn't allow steps, but you could do that yourself with a while loop:

Code:
var x = 1
while (x <= 10)
{
  sys.print(x)
  x = x + 3
}
Back to top
View user's profile Send private message
Agar
PostPosted: Tue 27 Oct 2009 1:19 pm    Post subject: Reply with quote



Joined: 27 Oct 2009
Posts: 18
Location: Paris, France

Thanks !
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum