PDA

View Full Version : read lines stop on number 10?



Tim Dobson
03-25-2011, 06:19 PM
noob question from me now... i have a script that gets the lines off a php file that are on seperate lines... it gets the lines fine and displays them correctly only what i want to do is only get 10 lines and when its at the 10th line i need it to stop...

here is my function


function listScripts(userobj, lines)
{
for (i = 0; i < lines.length; i++)
{
tmp = lines[i].split("\n");
print(userobj, "\x0305Template: \x0302" + tmp[0]);
}
}

Schmoopy
03-25-2011, 06:23 PM
function listScripts(userobj, lines)
{
for (i = 0; i < 10; i++)
{
tmp = lines[i].split("\n");
print(userobj, "\x0305Template: \x0302" + tmp[0]);
}
}

Tim Dobson
03-25-2011, 06:29 PM
ah greate stuff i did do this just to see if it works but i knew there wuld be something more clean


function listScripts(userobj, lines)
{
for (i = 0; i < lines.length; i++)
{
if (i == 10){
break;
} else {
tmp = lines[i].split("\n");
print(userobj, "\x0305Template: \x0302" + tmp[0]);
}
}
}