Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parsing

Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
09-23-2004 11:48
I haven't yet seen anyone post the workaround to this bug, so here it is:

CODE

//data is an input list retrieved from a listen or notecard or some such.
integer findnum;
test = [""];
for(i = 0; i<10; ++i)
{
findnum = llListFindList(data, test);
if(findnum != -1)
{
data = llDeleteSubList(data, findnum, findnum);
}
}


The bug is that llParseList2String produces at least one null string when you include seperators which are intended for deletion (also element zero always seems to be a null string). This for loop cleans up after it. Should you need null strings for some reason, you will have to find an alternative solution.
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-23-2004 13:21
Siro,

Is this a result of the 1.5.4, or is it from before that?
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
09-23-2004 18:36
A direct result of 1.5.4.

I reported the problem to a Linden. But either way, it's broken a good many scripts.
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
09-23-2004 19:35
It's an intended feature listed in the change log.

So nice of LL to change LSL without giving us a warning, or depreciating things.
_____________________
</sarcasm>
Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
09-23-2004 19:59
There was a non-intended bug associated with the intended feature.

where message will equal something along the lines of 'command1:this,is,my,command.



list data = llParseList2String(message, [",",":","."], ["command1","command2","command3"];

The above command will produce the list data containing, ["", "command1", "", "this", "is", "my", "command"]

Clearly the two nulls produced are a bug. The first should never have been there and the second should be removed on it's own.

The intended feature was for intended null strings to be returned when they weren't being returned. The bug is that null strings are being added where they are not intended.
Samhain Broom
Registered User
Join date: 1 Aug 2004
Posts: 298
09-24-2004 11:27
Oh yeah, that's known as INABIAF...


It's Not A Bug, It's A Feature.

;)
_____________________
rm -rf /bin/ladden #beware of geeks bearing grifts
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-25-2004 16:25
oh my lord this is going to break a good number of things, i'll get to work on a patch for XyCalc (which i'm pretty sure it's broken; i've been working on an ESL port and updates).

while we are fixing this function can we make it so it can search for more then 8 separators or spacers?

How about this?

list llParseString2List(string src, list separators, list spacers, integer flags)

FLAG_NULL_NONE

FLAG_NULL_BETWEEN_SEPARATOR_SPACERS

FLAG_NULL_BETWEEN_SPACERS

FLAG_NULL_BETWEEN_SEPARATORS

and they can be or'ed togeather.


here is a slightly better patch.
CODE

//data is an input list retrieved from a listen or notecard or some such.
list test=[""];
integer findnum;
while(1+(findnum = llListFindList(data, test)))
{
data = llDeleteSubList(data, findnum, findnum);
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
09-25-2004 23:50
From: someone
Originally posted by Strife Onizuka
oh my lord this is going to break a good number of things, i'll get to work on a patch for XyCalc (which i'm pretty sure it's broken; i've been working on an ESL port and updates).


XyCalc? It's been broken since the release of 1.5. I didin't realize it wasn't Xylor that made it though.

I just realized that this parsing change broke every script that uses email for object-to-object communications and parsed via /n's. There's a blank line in every email that used to get tossed aside, but now is kept. Oi.
_____________________
</sarcasm>
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-26-2004 00:12
it is Xylor's but i've quitely taken on the task of maintaining it.

just need to add the readme to the new version...

My XyCalc webpage


I have some features i want to add to it. It's taken some time to fully grok it.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
09-26-2004 21:24
One of the more annoying things about this change is that they have not acknowledged the several hundred man-hours of work they have inflicted on us.