Error in Wiki _limit page?
#1
In the Wiki, on the _Limit page, point number 5 says we should not try to use _limit for less than once every 60 seconds.
I think this should be 60 times per second, unless I'm reading it incorrectly.  Huh
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Reply
#2
It's once per 60 seconds.  

DO
   _LIMIT (1 / 60)
LOOP

^ Like the above.

Let me explain what it's doing here.

LIMIT 60 -- this says to let the loop run no more than 60 times per second.
LIMIT 30 -- 30 times per second max loop.
LIMIT 2 -- 2 times per second max loop.
LIMIT 1 -- 1 time per second max loop.
LIMIT 1 / 2 -- 1/2 time per second... or 1 time per 2 seconds, max loop speed.
LIMIT 1 / 3 -- 1/3 time per second... or 1 time per 3 seconds, max loop speed.

So a LIMIT 1 / 60 is a max speed of basically 1 loop per minute. (1 loop per 60 seconds.)

Anything longer than that, the fractions get so small, the math involved gets goofy.  If you need more than a 1/60 limit, then you need to get creative with how you accomplish it.  Wink

DO
     FOR I = 1 TO 10
         _LIMIT 1 / 60
    NEXT
    'Do stuff...
LOOP

^ A loop that only processes once every 10 minutes.
Reply
#3
Sorry Steve, I just don't understand the wording of rule #5 in the Wiki.

First it says "The _LIMIT statement sets the loop repeat rate of a program to so many per second"
and then in rule #5, "Do not use it to limit a loop to less than once every 60 seconds(.0167)"

_Limit 30, as you say, limits to no more than 30 times per second (or once every 1/30 second), which is much less than once every 60 seconds.

The function works, just as you described, but rule #5  in the Wiki is, I think upside-down, and should be not less than once every 1/60 second.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Reply
#4
That point #5 refers to the amount of loops not the amount of _LIMITs:

"Do not use it to limit a loop to less than once every 60 seconds(.0167)"

should better say:

"Do not use it to limit a loop to run less than once every 60 seconds (i.e. _LIMIT .0167 or _LIMIT 1/60)"

I'll change that wording in the Wiki...
Reply




Users browsing this thread: 1 Guest(s)