Hello fellow geeks!
The reason Im writing in that im trying to create some Javascripts for my project,
however when building the project it mentions an error on correct js syntax…
IT CANNOT RECOGNIZE THE SPLICE MEMBER OF AN ARRAY
above is a copy of the script
//////////////// SCRIPT START ///////////////////
class Queue
{
var queue = [ ];
var queueLenght = 0;
function IsEmpty()
{
return (queueLenght == 0);
}
function GetSize()
{
return queueLenght;
}
function Enqueue(element)
{
queue[queueLenght] = element;
queueLenght += 1;
}
function Dequeue()
{
var element;
if (queueLenght > 0)
{
queue.splice(0); // WHY IS THIS NOT WORKING IN UNITY?
queueLenght -= 1;
}
return element;
}
function GetElement(index)
{
var element;
if( index < queue.length
index >= 0 )
{
element = queue[queueLenght];
}
return element;
}
function GetOldestElement()
{
var element;
if (queue.length)
{
element = queue[queueLenght];
}
return element;
}
}
///////////////// SCRIPT END ////////////////////
ANY CLUES ANYONE?
THANX