Quote:
Originally Posted by DrakilorP2P
One-liner and without extra variables:
PHP Code:
serverr.day = this.dayarray[(this.dayarray.index(serverr.day) + 1) % this.dayarray.size()];
Assumes that serverr.day is a valid value.
|
Should avoid that. Unnecessary CPU cycles. Calling array.index() can be very slow when the array is big.
Quote:
Originally Posted by sssssssssss
How would you do that with serverr.var being the actual day set though? I think I know, but I'm going to play dumb so I can learn and not screw anything up. It needs to be a serverr.var for the day, so all people have it read, as this may change again later for dev Armageddon reasons. :P
|
Use a serverr.var of your choice instead of this.output. this.a will be your array, obviously. Also, the whole thing is just an example. You don't have to create an extra function for that stuff.