Difference between revisions of "LlLinksetDataWrite"

From Second Life Wiki
Jump to navigation Jump to search
(Minor grammar fixes; removed Protected param descriptions for "name" and "value" due to wiki parsing bug that duplicates them for duplicate param names in multi-function pages; noted that the pass param is not counted against storage limit; changed "64k" to "65536 bytes (64 kB)" after quick test since "64k" does not necessarily mean 65536 bytes)
m (grammar error fix again)
Line 30: Line 30:
|return_text=success or failure code.
|return_text=success or failure code.
|func_footnote
|func_footnote
|func_desc=Creates or updates an protected '''name:value''' pair from the linkset's datastore. Further attempts to read, write or update the '''name:value''' pair must use the protected versions of those functions and must supply the same string that was used in {{LSLP|pass}}.
|func_desc=Creates or updates a protected '''name:value''' pair from the linkset's datastore. Further attempts to read, write or update the '''name:value''' pair must use the protected versions of those functions and must supply the same string that was used in {{LSLP|pass}}.
|func_footnote
|func_footnote
|caveats=
|caveats=

Revision as of 18:45, 5 January 2023

Summary

Summary: llLinksetDataWrite, llLinksetDataWriteProtected

The llLinksetDataWrite and llLinksetDataWriteProtected functions create or update a name:value pair in the linkset datastore. The linkset datastore is a semi-permanent key-value store that is retained as a prim property regardless of the script is deleted or reset (via manual reset, llResetScript, llResetOtherScript, or cloning the object). If value is an empty string, the pair is deleted.

This function returns 0 on success or an error code on failure.

When these functions are called, the linkset_data event is triggered in all scripts running in the linkset with an action of LINKSETDATA_UPDATE, or LINKSETDATA_DELETE if the pair is deleted.

The linkset datastore can contain up to 65536 bytes (64 kB) of data and has no impact on script memory usage aside from the functions and events used to interact with it. Every pair written to the datastore consumes a number of bytes in the datastore equal to the length of name plus the length of value, plus an additional 32 bytes if written using llLinksetDataWriteProtected.

llLinksetDataWrite

Function: integer llLinksetDataWrite( string name, string value );

Creates or updates an unprotected name:value pair from the linkset's datastore.
Returns an integer success or failure code.

• string name The key of the name:value pair in the datastore to be updated or created.
• string value The value of the name:value pair.
All Issues ~ Search JIRA for related Bugs

llLinksetDataWriteProtected

Function: integer llLinksetDataWriteProtected( string name, string value, string pass );

Creates or updates a protected name:value pair from the linkset's datastore. Further attempts to read, write or update the name:value pair must use the protected versions of those functions and must supply the same string that was used in pass.
Returns an integer success or failure code.

• string name The key of the name:value pair in the datastore to be updated or created.
• string value The value of the name:value pair.
• string pass A pass phrase used to protect the name:value pair.
Caveats
  • Protecting a name:value pair adds an additional 32 bytes to its size in the datastore regardless of the length of pass. The length of pass itself is not counted against the data storage limit.
  • When writing a protected name, the linkset_data event fires as normal, however the value parameter will be an empty string.
All Issues ~ Search JIRA for related Bugs

Constant Description
LINKSETDATA_OK 0 The name:value pair was written to the datastore.
LINKSETDATA_EMEMORY 1 A name:value pair was too large to write to the linkset datastore.
LINKSETDATA_ENOKEY 2 The name supplied to llLinksetDataWrite was empty.
LINKSETDATA_EPROTECTED 3 The name:value pair has been protected from overwrite in the linkset's datastore.
LINKSETDATA_NOTFOUND 4 The named key could not be found in the linkset's datastore when attempting to delete it.
LINKSETDATA_NOUPDATE 5 The name:value stored in the linkset was not changed by the write operation because the value stored matches the value written.

Caveats

  • Events are only fired if the linkset's datastore is changed.
    • Rewriting an existing value to a name:value pair returns LINKSETDATA_NOUPDATE.
    • Writing an empty string to a nonexistent name in the datastore returns LINKSETDATA_NOTFOUND.
All Issues ~ Search JIRA for related Bugs

Examples

Deep Notes

Search JIRA for related Issues

Signature

function integer llLinksetDataWrite( string name, string value );
function integer llLinksetDataWriteProtected( string name, string value, string pass );