Blockland Forums > Modification Help

"Efficient" Queue

Pages: << < (2/2)

Chrono:

So it sets some values to 0 when the object is created.

Headcrab Zombie:


--- Quote from: Chrono on March 19, 2012, 04:32:40 PM ---So it sets some values to 0 when the object is created.

--- End quote ---
This

I didn't think it was necessary, but I adapted it off of code for a stack provided by others who know what they're doing, so I left it there.

DontCare4Free:


--- Quote from: Headcrab Zombie on March 19, 2012, 04:32:55 PM ---Just automatically set count and nextOut to 0 when you create the object. I didn't think it was necessary, but I adapted it off of code for a stack provided by others who know what they're doing, so I left it there.

--- End quote ---
Oh, okay. Didn't even know that there was such a feature.

Chrono:

It actually looks important because of these lines:
   %this.data[%this.count] = %data;
   %this.count++;
Because without it, it could end up like this:
%this.data = %data;
Rather than:
%this.data0 = %data;

for the first thing pushed.

You want that 0 there.

DontCare4Free:


--- Quote from: Chrono on March 19, 2012, 04:35:57 PM ---It actually looks important because of these lines:
   %this.data[%this.count] = %data;
   %this.count++;
Because without it, it could end up like this:
%this.data = %data;
Rather than:
%this.data0 = %data;

for the first thing pushed.

You want that 0 there.

--- End quote ---
Yeah, I know about that catch, I just didn't see when .onAdd was called. I've always worked around that by adding 0 first.

Pages: << < (2/2)

Go to full version