| Author |
Message
|
| Agar |
Posted: Tue 27 Oct 2009 1:10 am Post subject: Is it possible to use a "for" loop in COAL ? |
|
|
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.
Maybe the ability to do a "for" loop hasn't been implemented yet ?
Or maybe I just don't know how to do it...
Could somebody help me with this ? |
|
| Back to top |
|
 |
| andrewj |
Posted: Tue 27 Oct 2009 4:19 am Post subject: |
|
|

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 |
|
 |
| Agar |
Posted: Tue 27 Oct 2009 1:19 pm Post subject: |
|
|
Joined: 27 Oct 2009 Posts: 18 Location: Paris, France
|
|
| Back to top |
|
 |
|
|