PDA

View Full Version : Last



LightFreeze
01-25-2008, 05:19 PM
noticed this in a couple of scripts in the docs

last;
...
last if ChGroup;

anyone know what its doing?


@warnings
@script channel
@version 2.5
ChGroup;
create: channel
{
// locate the channel group recursively
ChGroup = nil;
GetGroupName(channel.id,ChannelGroup());
// was it found?
if(ChGroup != nil)
info(ChGroup.name + "." + channel.name);
}
...
GetGroupName: cid, chgroup
{
if(ChGroup) return;
while(chgroup)
{
chchannel = chgroup.firstChannel();
while(chchannel)
{
if(chchannel.id == cid)
{
ChGroup = chgroup;
last;
}
chchannel = chgroup.nextChannel();
}
last if ChGroup;
GetGroupName(cid,ChannelGroup(chgroup)); // recursive call
chgroup = chgroup.next();
}
}