LinksetIndexing: Difference between revisions
Jump to navigation
Jump to search
Created page with "{{LSL Header}} == By Name == {|cellspacing="0" cellpadding="3" border="1" style="border: 1px solid #aaaaaa; margin: 1em 1em 1em 0pt; background-color: #ffffff; border-collapse:…" |
mNo edit summary |
||
| Line 1: | Line 1: | ||
{{LSL Header}} | {{LSL Header}} | ||
== By Name == | == By Exact Name == | ||
{|cellspacing="0" cellpadding="3" border="1" style="border: 1px solid #aaaaaa; margin: 1em 1em 1em 0pt; background-color: #ffffff; border-collapse: collapse" width="80%" | {|cellspacing="0" cellpadding="3" border="1" style="border: 1px solid #aaaaaa; margin: 1em 1em 1em 0pt; background-color: #ffffff; border-collapse: collapse" width="80%" | ||
Revision as of 06:02, 12 September 2011
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
By Exact Name
One Name - Multiple Links | ||||||||
|---|---|---|---|---|---|---|---|---|
|
Searches for multiple prims that share a common specific name and returns a list of linkset numbers. Otherwise an empty list if none found. <lsl> list LinkedList(string Needle) { list Needles; integer Hay = 1; integer Stacks = llGetNumberOfPrims(); for(; Hay <= Stacks; ++Hay ) if(llGetLinkName(Hay) == Needle) Needles += Hay; return Needles; } </lsl>
Released into public domain. By Nexii Malthus.
|
One Name - One Link | ||||||||
|---|---|---|---|---|---|---|---|---|
|
Searches for a single prim that has a specific name. Returns 0 if not found. <lsl> integer Linked(string Needle) { integer Prims = llGetNumberOfPrims()+1; while(--Prims) if(llGetLinkName(Prims) == Needle) return Prims; return 0; } </lsl>
Released into public domain. By Nexii Malthus.
|
Multiple Names - One Link each | ||||||||
|---|---|---|---|---|---|---|---|---|
|
Searches and replaces all strings in Needles list with integer linkset numbers, where the strings exactly match a prim name. <lsl> list ListLinked(list Needles) { integer Prims = llGetNumberOfPrims()+1;
while(--Prims) {
integer Ptr = llListFindList(Needles,[llGetLinkName(Prims)]);
if(~Ptr) Needles = llListReplaceList(Needles,[Prims],Ptr,Ptr);
}
return Needles;
} </lsl>
Released into public domain. By Nexii Malthus.
|