Skip to content
lsl.devlsl.devLSL Dev

User:Peter Stindberg/is uuid

Wiki description

Created by Peter Stindberg, this function will take a key as input and return TRUE or FALSE depending on wether the key is a valid Second Life agent UUID. There are two formal checks there for key-length and number of dashes in the string.
integer is_uuid(key uuid) {
    return (
           (llStringLength(uuid) == 36) 
        && (llGetSubString(uuid, 14, 14) == "4")
        && (llGetListLength(llParseString2List(uuid, ["-"], [])) == 5)
    );
}

Return value notes

Returns an integer TRUE or FALSE.

Caveats

The function checks for a signal that is widely believed to be only part of agent UUID's and not object UUID's. Extensive tests by Peter Stindberg as well as other users have shown no counter-example up to date. There is no guarantee that is true for all agent UUID's, nor that it won't change in the future.
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.