GenUUID

From Second Life Wiki
Jump to: navigation, search

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