rejetto forum
Software => HFS ~ HTTP File Server => Programmers corner => Topic started by: rejetto on April 16, 2009, 12:30:58 PM
-
this will work in next build.
{.set|#x|10.}
{.while|#x|{: {.dec|#x.} ciao! :}.}
the test-block can be anything.
the example is a short for this more generic form
{.set|#x|10.}
{.while|{:{.^#x.}:}|{: {.dec|#x.} ciao! :}.}
-
The static variables are one more in hfs but attention, because variables so defined will be available in common with all the current connections, what lets suppose that in the previous example every user, what will make execute the macro of the example, will deduct the variable *x.
at start time
first user connected
(user1) define #x as 10
at start time + one delay
(user1) dec #x -> #x contain 9
at start time + two delay
(user1) dec #x -> #x contain 8
at start time + three delay
second user connected
(user2) define #x as 10
(user1) dec #x -> #x contain 9
at start time + four delay
(user2) dec #x -> #x contain 8
(user1) dec #x -> #x contain 7
.........
at the end every user has the follow result
(user1) 9 8 9 7 5 3 1 ciao!
(user2) 7 5 3 1 ciao!
it is the same macro but not the same result. 8)
:D ;)
-
it's up to you to use it wisely.
anyway AFAIK, nothing will interrupt the while.
if you are running the while, there's no user interaction/connection that will interfere.
the while can easily HANG hfs for a while.
i will put an optional timeout.
-
If I tell all this, it is not for me, but to warn risks which the persons can meet with their scripts. If you are attentive in various posts that I make on sources, I am certain that you will know how to implant railings which will avoid posts 'report of bug' ;)