Jump to content

llSubStringIndex() vs. List and llDumpList2String()


Love Zhaoying
 Share

You are about to reply to a thread that has been inactive for 1991 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Experienced scripter here...

On longer (larger) projects, I continually find myself going through this cycle:

1) I'll use a list for this task.

2) Crap, now I have llList() calls all over the place...for no particular reason other than to get the next list entry which I could have gotten with a string function..

3) Crap, if I use a list, then I have go to back and dump the remainder part of the list to a string after just checking first or second entry because of earlier decisions about the data content and passing between scripts via llMessageLinked(), etc..

4) Guess I should have just used normal string functions unless I know I really need a list.  (Starts over and removes most list functionality, uses llSubStringIndex() to parse the data, ends up with much less code.)

Is this a normal development cycle for other LSL programmers?

 

Link to comment
Share on other sites

It's certainly a familiar struggle.  LSL is not truly designed for major data handling, so we're forced into some rather clumsy compromises at times.  Do we parse strings to lists, extract information, and rebuild updated strings later? Do we leave strings intact and try to identify and extract substrings, replacing them with updates later? I make decisions on the basis of what seems easiest at the time -- easiest meaning "less work for me" but also "most efficient use of script memory and time" -- and like you, I sometimes regret my choice and end up ripping out hours of coding.  I can't say that I have a well-conceived and consistent set of rules for myself, but I find that I don't fall into the cycle of regret and self recrimination as much as I used to years ago.   I must be learning something.

BTW, personally, I like lists.  They remind me of my years spent with large arrays in FORTRAN.  I just wish LSL handled them better.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1991 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...