Difference between revisions of "Category:LSL LinksetData"
Rider Linden (talk | contribs) |
Hiro Ember (talk | contribs) |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 3: | Line 3: | ||
= Introduction = | = Introduction = | ||
Linksets may store up to | Linksets may store up to 128KiB of data as key/value pairs available to LSL scripts. This data is attached to the root prim in the linkset and survives transfer, script reset and object copying, it does not count against the memory usage of any script. Once set, the only way to erase it is via either the llLinksetDataReset or the llLinksetDataDelete functions. Whenever a script successfully modifies the linkset data using the llLinksetDataReset, llLinksetDataWrite or llLinksetDataCreate functions a linkset_data event is fired in all scripts in the linkset describing the action taken and key name that was affected. | ||
Linkset data is not visible outside of a linkset; a script may only access the linkset data for the linkset that it is running in. Linkset data is not applicable to avatars. | Linkset data is not visible outside of a linkset; a script may only access the linkset data for the linkset that it is running in. Linkset data is not applicable to avatars. | ||
Line 13: | Line 13: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataWrite | |func=[[llLinksetDataWrite]] | ||
|func_desc=Creates or updates a key/value pair in the linksets datastore. | |func_desc=Creates or updates a key/value pair in the linksets datastore. | ||
|p1_type=string|p1_name=name|p1_desc=key name for data to be stored. | |p1_type=string|p1_name=name|p1_desc=key name for data to be stored. | ||
|p2_type=string|p2_name=value|p2_desc=String data to be associated with this key. | |p2_type=string|p2_name=value|p2_desc=String data to be associated with this key. | ||
|return_type=integer|return_text= | |return_type=integer|return_text=indicating success or failure. {{mono|0}} is success, a positive number indicates failure. | ||
|func_footer | |func_footer | ||
|caveats=If value is an empty string, the key is deleted from the linkset data. | |caveats=If value is an empty string, the key is deleted from the linkset data. | ||
Line 23: | Line 23: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataRead | |func=[[llLinksetDataRead]] | ||
|func_desc=Reads the value associated with a key from the linkset's key-value datastore. | |func_desc=Reads the value associated with a key from the linkset's key-value datastore. | ||
|p1_type=string|p1_name=name|p1_desc=key name for data to be read. | |p1_type=string|p1_name=name|p1_desc=key name for data to be read. | ||
|return_type=string|return_text= | |return_type=string|return_text=associated with the key. If the key does not exist, an empty string is returned. | ||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
Line 32: | Line 32: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataDelete | |func=[[llLinksetDataDelete]] | ||
|func_desc=Removes a key value pair from the linkset's datastore. | |func_desc=Removes a key value pair from the linkset's datastore. | ||
|p1_type=string|p1_name=name|p1_desc=key name for data to be read. | |p1_type=string|p1_name=name|p1_desc=which is the key name for data to be read. | ||
|return_type=| | |return_type=| | ||
|func_footer | |||
|caveats=none | |||
}} | |||
{{LSL Function/Head | |||
|func_sleep=0.0|func_energy=10.0 | |||
|func=[[llLinksetDataDeleteFound]] | |||
|func_desc=finds and attempts to delete all keys in the data store that match pattern. | |||
|p1_type=string|p1_name=pattern|p1_desc=A regular expression describing which keys to delete. | |||
|p2_type=string|p2_name=pass|p2_desc=Optional pass phrase to delete protected keys. | |||
|return_type=list|return_text=of the number of keys deleted or skipped. | |||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
Line 41: | Line 51: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_id=|func_sleep=0.0|func_energy=10.0 | |func_id=|func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataReset | |func=[[llLinksetDataReset]] | ||
|func_desc=Erases all existing keys value pairs in the linkset's datastore. | |func_desc=Erases all existing keys value pairs in the linkset's datastore. | ||
|return_type=| | |return_type=| | ||
Line 49: | Line 59: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataAvailable | |func=[[llLinksetDataAvailable]] | ||
|func_desc= | |func_desc=The number of bytes available in the linkset's datastore | ||
|return_type=integer|return_text= | |return_type=integer|return_text=with the number of bytes free in the datastore. | ||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
Line 57: | Line 67: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataCountKeys | |func=[[llLinksetDataCountKeys]] | ||
|func_desc=Returns the number of keys used in the datastore. | |func_desc=Returns the number of keys used in the datastore. | ||
|return_type=integer|return_text= | |return_type=integer|return_text=with the total number of keys in use. | ||
|func_footer | |||
|caveats=none | |||
}} | |||
{{LSL Function/Head | |||
|func_sleep=0.0|func_energy=10.0 | |||
|func=[[llLinksetDataCountFound]] | |||
|func_desc=Returns the number of keys in the linkset datastore that match the pattern supplied in the pattern. | |||
|p1_type=string|p1_name=pattern|p1_desc=A regular expression describing which keys to return. | |||
|return_type=integer|return_text=count of the keys in the datastore that match the supplied pattern. | |||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
Line 65: | Line 84: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataListKeys | |func=[[llLinksetDataListKeys]] | ||
|func_desc=Return a list of keys currently in use in the linkset data. | |func_desc=Return a list of keys currently in use in the linkset data. | ||
|p1_type=integer|p1_name=first|p1_desc=The (zero based) index of the first key to return. | |p1_type=integer|p1_name=first|p1_desc=The (zero based) index of the first key to return. | ||
|p2_type=integer|p2_name=count|p2_desc=The maximum number of key names to return in the list. | |p2_type=integer|p2_name=count|p2_desc=The maximum number of key names to return in the list. | ||
|return_type=list|return_text= | |return_type=list|return_text=of keys stored in the linkset data. | ||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
Line 75: | Line 94: | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func_sleep=0.0|func_energy=10.0 | |func_sleep=0.0|func_energy=10.0 | ||
|func=llLinksetDataFindKeys | |func=[[llLinksetDataFindKeys]] | ||
|func_desc=Return a list of keys the linkset data which match the expression passed to the function. | |func_desc=Return a list of keys the linkset data which match the expression passed to the function. | ||
|p1_type=string|p1_name=regex|p1_desc=A regex expression to search for. | |p1_type=string|p1_name=regex|p1_desc=A [https://en.wikipedia.org/wiki/Regular_expression regex expression] to search for. | ||
|p2_type=integer|p2_name=first|p2_desc=The (zero based) index of the first key to return. | |p2_type=integer|p2_name=first|p2_desc=The (zero based) index of the first key to return. | ||
|p3_type=integer|p3_name=count|p3_desc=The maximum number of key names to return in the list. | |p3_type=integer|p3_name=count|p3_desc=The maximum number of key names to return in the list. | ||
|return_type=list|return_text= | |return_type=list|return_text=of keys matching regex stored in the linkset data. | ||
|func_footer | |func_footer | ||
|caveats=none | |caveats=none | ||
}} | }} | ||
= Events = | = Events = | ||
{{LSL Function/Head | {{LSL Function/Head | ||
|func=linkset_data | |func=[[linkset_data]] | ||
|p1_type=integer|p1_name=action|p1_desc=The action taken on the linkset datastore. reset, update or delete. | |p1_type=integer|p1_name=action|p1_desc=The action taken on the linkset datastore. reset, update or delete. | ||
|p2_type=string|p2_name=name|p2_desc=The name of key changed. Empty string for reset. | |p2_type=string|p2_name=name|p2_desc=The name of key changed. Empty string for reset. |
Latest revision as of 04:34, 8 September 2023
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Introduction
Linksets may store up to 128KiB of data as key/value pairs available to LSL scripts. This data is attached to the root prim in the linkset and survives transfer, script reset and object copying, it does not count against the memory usage of any script. Once set, the only way to erase it is via either the llLinksetDataReset or the llLinksetDataDelete functions. Whenever a script successfully modifies the linkset data using the llLinksetDataReset, llLinksetDataWrite or llLinksetDataCreate functions a linkset_data event is fired in all scripts in the linkset describing the action taken and key name that was affected.
Linkset data is not visible outside of a linkset; a script may only access the linkset data for the linkset that it is running in. Linkset data is not applicable to avatars.
When merging two linksets, both with linkset data, the new root's data is preserved and the simulator makes an effort to move as many of the key value pairs from the old root to the new. If there is insufficient space for all data the simulator will discard some data from the old root. The data selected for preservation may be arbitrary.
Functions
llLinksetDataWrite
Function: integer llLinksetDataWrite( string name, string value );0.0 | Forced Delay |
10.0 | Energy |
Creates or updates a key/value pair in the linksets datastore.
Returns an integer indicating success or failure. 0 is success, a positive number indicates failure.
• string | name | – | key name for data to be stored. | |
• string | value | – | String data to be associated with this key. |
Caveats
If value is an empty string, the key is deleted from the linkset data.
llLinksetDataRead
Function: string llLinksetDataRead( string name );0.0 | Forced Delay |
10.0 | Energy |
Reads the value associated with a key from the linkset's key-value datastore.
Returns a string associated with the key. If the key does not exist, an empty string is returned.
• string | name | – | key name for data to be stored.key name for data to be read. |
llLinksetDataDelete
Function: llLinksetDataDelete( string name );0.0 | Forced Delay |
10.0 | Energy |
Removes a key value pair from the linkset's datastore.
• string | name | – | key name for data to be stored.key name for data to be read.which is the key name for data to be read. |
llLinksetDataDeleteFound
Function: list llLinksetDataDeleteFound( string pattern, string pass );0.0 | Forced Delay |
10.0 | Energy |
finds and attempts to delete all keys in the data store that match pattern.
Returns a list of the number of keys deleted or skipped.
• string | pattern | – | A regular expression describing which keys to delete. | |
• string | pass | – | Optional pass phrase to delete protected keys. |
llLinksetDataReset
Function: llLinksetDataReset( );0.0 | Forced Delay |
10.0 | Energy |
Erases all existing keys value pairs in the linkset's datastore.
llLinksetDataAvailable
Function: integer llLinksetDataAvailable( );0.0 | Forced Delay |
10.0 | Energy |
The number of bytes available in the linkset's datastore
Returns an integer with the number of bytes free in the datastore.
llLinksetDataCountKeys
Function: integer llLinksetDataCountKeys( );0.0 | Forced Delay |
10.0 | Energy |
Returns the number of keys used in the datastore.
Returns an integer with the total number of keys in use.
llLinksetDataCountFound
Function: integer llLinksetDataCountFound( string pattern );0.0 | Forced Delay |
10.0 | Energy |
Returns the number of keys in the linkset datastore that match the pattern supplied in the pattern.
Returns an integer count of the keys in the datastore that match the supplied pattern.
• string | pattern | – | A regular expression describing which keys to delete.A regular expression describing which keys to return. |
llLinksetDataListKeys
Function: list llLinksetDataListKeys( integer first, integer count );0.0 | Forced Delay |
10.0 | Energy |
Return a list of keys currently in use in the linkset data.
Returns a list of keys stored in the linkset data.
• integer | first | – | The (zero based) index of the first key to return. | |
• integer | count | – | The maximum number of key names to return in the list. |
llLinksetDataFindKeys
Function: list llLinksetDataFindKeys( string regex, integer first, integer count );0.0 | Forced Delay |
10.0 | Energy |
Return a list of keys the linkset data which match the expression passed to the function.
Returns a list of keys matching regex stored in the linkset data.
• string | regex | – | A regex expression to search for. | |
• integer | first | – | The (zero based) index of the first key to return.The (zero based) index of the first key to return. | |
• integer | count | – | The maximum number of key names to return in the list.The maximum number of key names to return in the list. |
Events
linkset_data
Function: linkset_data( integer action, string name, string value );• integer | action | – | The action taken on the linkset datastore. reset, update or delete. | |
• string | name | – | key name for data to be stored.key name for data to be read.which is the key name for data to be read.The name of key changed. Empty string for reset. | |
• string | value | – | String data to be associated with this key.The value associated with the key. Empty string for reset or delete. |
Pages in category "LSL LinksetData"
The following 11 pages are in this category, out of 11 total.