Difference between revisions of "Category:LSL Key"

From Second Life Wiki
Jump to navigation Jump to search
Line 10: Line 10:
When passed as the parameter for a {{LSLGC|Conditional|conditional}} it only evaluates true if it is a valid key and not [[NULL_KEY]].  You can use this to detect if an arbitrary string is a valid key as follows:
When passed as the parameter for a {{LSLGC|Conditional|conditional}} it only evaluates true if it is a valid key and not [[NULL_KEY]].  You can use this to detect if an arbitrary string is a valid key as follows:


<pre>//by: Strife Onizuka
<pre>
integer isKey(key in) {
integer isKey(key in) {
     if(in) return 2;
     if(in) return 2;
     return (in == NULL_KEY);
     return (in == NULL_KEY);
}</pre>
}</pre>
<pre>// by: Anylyn Hax
1) It whould be nice if Mr Strife Onizuka whould less write his NAME on every wall and more explain what this poor code want to tell us
2) The code is not your invention its standard return use.
<pre>

Revision as of 02:05, 18 July 2007

A key is a unique identifier in Second Life (often referred to as a UUID) for anything mostly, be it a prim, avatar, texture, etc.

The key itself is formed of alphanumeric characters (a-z and 0-9) and each section of the key is broken up by dashes.

An example key:

"a822ff2b-ff02-461d-b45d-dcd10a2de0c2"

When passed as the parameter for a conditional it only evaluates true if it is a valid key and not NULL_KEY. You can use this to detect if an arbitrary string is a valid key as follows:

integer isKey(key in) {
    if(in) return 2;
    return (in == NULL_KEY);
}