Jump to content

Safe separator for llDumpList2String


Welder1488303095
 Share

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

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

Recommended Posts

Any recommendations for which character to use as a separator for storing, transporting and retrieving lists with  llDumpList2String etc .


I will be storing user input so an out of way character is needed, but it does not have to be foolproof; i.e.. the script  crashing if someone  purposely feeds that character is acceptable

A control character perhaps? Any best practices on this subject?

Link to comment
Share on other sites

Pipe symbol is not safe at all for my purposes. I was thinking something more exotic like ascii char 31 which is nicely named in ascii tables "unit separator", and prints as a small triangle symbol.

string SEPARATOR = llBase64ToString(llDeleteSubString(llIntegerToBase64(31),0,3));

Any reason I should NOT use it?

Link to comment
Share on other sites

In most of my projects I use separator  ",,," as I'm yet to see an SL name that includes three commas in a row. This of course does increase memory usage by 2 bytes per name which may be relevant if strings or lists are long so a script operates within a thin red line between stack and heap :)

In those projects where a separator indeed may turn out crucial, I use weird unicode characters from non-latin sets, those of course must be translated back and forth but it is pretty trivial.

Link to comment
Share on other sites

  • 4 weeks later...

In the end I used character 31

string SAFE_SEP = ""; //chr(31)

and after a while I ended up using it everywhere, even in trivial situations

In SL it prints as very distinct black triangle , which is good for visual inspection

The only drawback I can see is that, as above, it will not show at all in notepad, and show  as a space in wordpad and in lsl editor. Notepad++ shows it as a "US" (Unit Separator) on black background so that's ok. In all cases, copy and pasting it to-and-fro preserves it (as one would reasonably expect) , so you can copy it from above even though you can't see it.

Thank you all for your replies.

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...