LlGenerateKey: Difference between revisions
Jump to navigation
Jump to search
New page: {{LSL_Function |func=generateKey |func_desc=Generates a key using Type 3 (MD5) UUID generation to create a unique key using region-name, object-key, service and variable. |return_type=key ... |
No edit summary |
||
| Line 9: | Line 9: | ||
|cat1=Examples | |cat1=Examples | ||
|cat2=Library | |cat2=Library | ||
|examples=key timeKey = generateKey("time", (string)llGetUnixTime()); | |examples=<lsl>key timeKey = generateKey("time", (string)llGetUnixTime());</lsl> | ||
}} | }} | ||
Revision as of 04:40, 3 September 2008
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: key generateKey( string service, string variable );
Generates a key using Type 3 (MD5) UUID generation to create a unique key using region-name, object-key, service and variable.
Returns a key The generated key
| • string | service | – | The service, object, function, or whatever else this key may represent. | |
| • string | variable | – | Any variable(s) relevant to the service that uniquely distinguish it. |
Examples
<lsl>key timeKey = generateKey("time", (string)llGetUnixTime());</lsl>
Implementation
<lsl>key generateKey(string service, string variable) {
return (key)llInsertString(
llInsertString(
llInsertString(
llInsertString(
llMD5String(
"secondlife://" + llGetRegionName() + "/" +
(string)llGetKey() + "/" + service + "/" +
variable,
0 // This is reserved by specification, will
// be increased with new/different versions.
),
8,
"-"
),
13,
"-"
),
18,
"-"
),
23,
"-"
);
}</lsl>