Help! javascript generated structure: too many members/array to the queue

jacopoB's picture

I've never worked with javascript but i've managed to create a structure, the problem is that i dont know how to dequeue the values. (I want to keep only the newest values 20-40 per points {x,y,z})

Anyone can help?

_Queue = []

function (__structure Queue) main (__number inputNumber[12]) { var result = new Object(); _Queue.push([inputNumber[0],inputNumber[1],inputNumber[2]]) _Queue.push([inputNumber[3],inputNumber[4],inputNumber[5]]) _Queue.push([inputNumber[6],inputNumber[7],inputNumber[8]]) _Queue.push([inputNumber[9],inputNumber[10],inputNumber[11]]) result.Queue = _Queue; return result; }

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Help! javascript generated structure: too many ...

Before the result.Queue line, try:

if (_Queue.length > Size) _Queue.shift()

Also, make an index input for Size where you made the other inputs.

jacopoB's picture
Re: Help! javascript generated structure: too many ...

It worked but i think that the values are too many or the code itself is slow because it slows progressively. Can i clear out point per point? (x,y,z) i tryed to make 3 different javascript per poit each ine with that function but now idk how to paste them together in another javascript ( queue1,queue2,queue3,queue4)

PreviewAttachmentSize
Schermata 2014-11-07 alle 22.59.12.png
Schermata 2014-11-07 alle 22.59.12.png148.49 KB