Difference between revisions of "Category talk:LSL String"

From Second Life Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 12: Line 12:


Assuming "data" was a string such as "Douglas Adams,High on a rocky promontory\nsat an Electric Monk on a bored horse." it is presented as "High on a rocky promontory\nsat an Electric Monk on a bored horse." by the [[llSetText]]
Assuming "data" was a string such as "Douglas Adams,High on a rocky promontory\nsat an Electric Monk on a bored horse." it is presented as "High on a rocky promontory\nsat an Electric Monk on a bored horse." by the [[llSetText]]
<lsl>
<source lang="lsl2">
default
default
{
{
Line 20: Line 20:
     }
     }
}
}
</lsl>
</source>


Whereas
Whereas


<lsl>
<source lang="lsl2">
default
default
{
{
Line 32: Line 32:
     }
     }
}
}
</lsl>
</source>


is presented as "High on a rocky promontory  
is presented as "High on a rocky promontory  
Line 45: Line 45:
Thanx Strife. 6 months ago "LSO" meant "London Symphony Orchestra" to me. And "mono" was what to expect from original pressings of Beach Boys and Beatles albums. -- '''[[User:EddyFragment Robonaught|Eddy]]''' 03:23, 30 May 2009 (UTC)
Thanx Strife. 6 months ago "LSO" meant "London Symphony Orchestra" to me. And "mono" was what to expect from original pressings of Beach Boys and Beatles albums. -- '''[[User:EddyFragment Robonaught|Eddy]]''' 03:23, 30 May 2009 (UTC)


== Alternatives to Null Character as an Escape Character ==
== Alternatives to Null Character as a Separator ==


Just curious if anyone has found a good character for use as an escape character in strings that should never occur in actual user-input? Ordinarily I'd use the null character in other languages, but LSL specifically prevents that as an option. The alternative is to ensure that any separated content (commands, flags etc.) come first, so once those are consumed you can just treat the remaining string as-is, but this isn't an option if you want to transmit several separated values. I was thinking one of the old ASCII control codes might be used, but I'm not clear on how or where these might potentially appear in user-input; the goal is of course to take user-input without having to perform escaping upon it (due to the time/memory costs). <br/>-- '''[[User:Haravikk_Mistral|Haravikk]]''' <sup><small>([[User_talk:Haravikk_Mistral|talk]]|[[Special:Contributions/Haravikk_Mistral|contribs]])</small></sup> 06:07, 16 November 2015 (PST)
Just curious if anyone has found a good character for use as a separator in strings that should never occur in actual user-input? Ordinarily I'd use the null character in other languages, but LSL specifically prevents that as an option. The alternative is to ensure that any separated content (commands, flags etc.) come first, so once those are consumed you can just treat the remaining string as-is, but this isn't an option if you want to transmit several separated values. I was thinking one of the old ASCII control codes might be used, but I'm not clear on how or where these might potentially appear in user-input; the goal is of course to take user-input without having to perform escaping upon it (due to the time/memory costs). <br/>-- '''[[User:Haravikk_Mistral|Haravikk]]''' <sup><small>([[User_talk:Haravikk_Mistral|talk]]|[[Special:Contributions/Haravikk_Mistral|contribs]])</small></sup> 06:07, 16 November 2015 (PST)
 
:I wrote a dynamic separator selector for [[TightList]], you can get it by including the esl file and defining TIGHTLISTDUMPUNICODE. I've made advances in character generation since writing TL but it should give you the idea. In a couple weeks I'll put my [[Combined Library]] (which includes TL) on github and then work on updating it. -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 20:01, 30 November 2015 (PST)

Latest revision as of 21:00, 30 November 2015

llSubStringIndex is not mentioned

The function llGetSubString(string src, integer start, integer end) is not mentioned at all on this page. It should be added to the list of build-in functions at the page end.

Hi, llSubStringIndex is in the category now, llGetSubString was there when I looked. If you see any more missing functions like that it is usually easy to fix. Click Edit atop the function's page, and then push the Save Page button without any changes. That will refresh the index. The same trick usually works if you see a function that should not be in the category, like any for the wrong language. The categories are on the function pages but sometimes the wiki needs a little help to keep track. --Cerise Sorbet 06:18, 11 August 2010 (UTC)

Value1 equals value2 is how I spelled value1 == value2, back over in the Category tab. Please fix the spelling, if you're enough more Wiki literate than I to know how.

The == operator needs an example.

Working with the dataserver event I discovered that "\n" within a string taken from a notecard is not read by for example llSetText() as a new line.

Assuming "data" was a string such as "Douglas Adams,High on a rocky promontory\nsat an Electric Monk on a bored horse." it is presented as "High on a rocky promontory\nsat an Electric Monk on a bored horse." by the llSetText

default
{
    dataserver(key id, string data)
    {
        llSetText(llList2String(llCSV2List(data),1), <1.0,1.0,1.0>, 1.0);
    }
}

Whereas

default
{
    state_entry()
    {
        llSetText("High on a rocky promontory\nsat an Electric Monk on a bored horse.", <1.0,1.0,1.0>, 1.0);
    }
}

is presented as "High on a rocky promontory sat an Electric Monk on a bored horse." as one would expect. -- Eddy 01:48, 29 May 2009 (UTC)

Escaped character support is a feature of the compiler, not the VM. You want Unescape. -- Strife (talk|contribs) 12:12, 29 May 2009 (UTC)

What's the VM? -- Eddy 01:30, 30 May 2009 (UTC)

Mono or LSO. It's what runs and sandboxes your script. VM = Virtual Machine. -- Strife (talk|contribs) 03:13, 30 May 2009 (UTC)

Thanx Strife. 6 months ago "LSO" meant "London Symphony Orchestra" to me. And "mono" was what to expect from original pressings of Beach Boys and Beatles albums. -- Eddy 03:23, 30 May 2009 (UTC)

Alternatives to Null Character as a Separator

Just curious if anyone has found a good character for use as a separator in strings that should never occur in actual user-input? Ordinarily I'd use the null character in other languages, but LSL specifically prevents that as an option. The alternative is to ensure that any separated content (commands, flags etc.) come first, so once those are consumed you can just treat the remaining string as-is, but this isn't an option if you want to transmit several separated values. I was thinking one of the old ASCII control codes might be used, but I'm not clear on how or where these might potentially appear in user-input; the goal is of course to take user-input without having to perform escaping upon it (due to the time/memory costs).
-- Haravikk (talk|contribs) 06:07, 16 November 2015 (PST)

I wrote a dynamic separator selector for TightList, you can get it by including the esl file and defining TIGHTLISTDUMPUNICODE. I've made advances in character generation since writing TL but it should give you the idea. In a couple weeks I'll put my Combined Library (which includes TL) on github and then work on updating it. -- Strife (talk|contribs) 20:01, 30 November 2015 (PST)