Difference between revisions of "GenUUID"

From Second Life Wiki
Jump to navigation Jump to search
m (bad distribution)
m (<lsl> tag to <source>)
 
Line 6: Line 6:
|func_footnote=
|func_footnote=
See also: [[String]]
See also: [[String]]
|spec=<lsl>string  genUUID() {
|spec=<source lang="lsl2">string  genUUID() {
     string characters = "0123456789abcdefghijklmnopqrstuvwxyz";
     string characters = "0123456789abcdefghijklmnopqrstuvwxyz";
     float len = (float)llStringLength(characters);
     float len = (float)llStringLength(characters);
Line 18: Line 18:
}
}


</lsl>
</source>
|examples=<lsl>
|examples=<source lang="lsl2">
default
default
{
{
Line 28: Line 28:
}
}


//Says something like  4kwlhahj-ilpw-df7v-wv8i-3i7m9gx6309</lsl>
//Says something like  4kwlhahj-ilpw-df7v-wv8i-3i7m9gx6309</source>
|helpers
|helpers
|notes
|notes

Latest revision as of 15:08, 24 January 2015

Summary

Function: string GenUUID( );

Returns a string that is a clone look of a uuid, these keys are not registered within SL.

See also: String

Specification

string  genUUID() {
    string characters = "0123456789abcdefghijklmnopqrstuvwxyz";
    float len = (float)llStringLength(characters);
    string emp;
    integer i = 32;
    integer p;
    do
       emp += llGetSubString(characters, p = (integer)llFrand(len), p);
    while(--i);
    return llGetSubString(emp,0,7) + "-" + llGetSubString(emp,8,11)+ "-" + llGetSubString(emp,12,15)+ "-" + llGetSubString(emp,16,19)+ "-" + llGetSubString(emp,20,31);
}

Examples

default
{
    touch_start(integer total_number)
    {
        llSay(0, genUUID());
    }
}

//Says something like  4kwlhahj-ilpw-df7v-wv8i-3i7m9gx6309