[FilterScript] Alcor's event system!
#11

Quote:
Originally Posted by adri[4]Life
View Post
Code that is using foreach = Optimized, Code that is using for(new i; i < MAX_PLAYERS; i++) is unoptimized
The second part is not always true, sometimes you want to reset an array which is MAX_PLAYERS long.

Quote:
Originally Posted by Meller
View Post
MAX_PLAYERS is just a macro definition of an int..

Foreach is the definition of a macro defined for() loop (I guess, never looked into its source)

It's the same thing, for() while() etc etc, it's still PAWN, it's still a loop.




No matter what people use, it's the same thing over and over, but how you use it is what's important.
https://sampwiki.blast.hk/wiki/Control_Structures#Loops
Its technically not a "still the same loop".

It uses a loop, yes, but a dynamic loop, saving you processing time.
When you use frequently a certain loop, like in a timer with an interval of 1000 milliseconds, you'd want it to be as fast as possible, foreach will sure ensure it.

foreach uses the y_iterate approach, which is also a child library of YSI.

Loops are useful, but they're better when they're short.
Reply


Messages In This Thread
Alcor's event system! - by OperawindFury - 12.09.2017, 16:05
Re: Alcor's event system! - by xCaf - 12.09.2017, 16:25
Re: Alcor's event system! - by SonnyGamer - 12.09.2017, 19:55
Re: Alcor's event system! - by Sew_Sumi - 12.09.2017, 20:30
Re: Alcor's event system! - by DonaldDuck - 16.09.2017, 17:06
Re: Alcor's event system! - by Logic_ - 16.09.2017, 17:43
Re: Alcor's event system! - by adri[4]Life - 16.09.2017, 19:14
Re: Alcor's event system! - by Meller - 16.09.2017, 20:29
Re: Alcor's event system! - by adri[4]Life - 16.09.2017, 20:41
Re: Alcor's event system! - by Meller - 16.09.2017, 20:57
Re: Alcor's event system! - by Kaperstone - 16.09.2017, 21:51

Forum Jump:


Users browsing this thread: 2 Guest(s)