Last active
August 4, 2023 14:57
-
-
Save sl-service-account/3a7f2cced16826880add358e0394cbca to your computer and use it in GitHub Desktop.
Count, delete multiple LSD values by pattern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default { | |
state_entry() { | |
// Add some LSD values starting with "foo" and some that don't | |
llLinksetDataWrite("foobar", "a"); | |
llLinksetDataWrite("foobaz", "a"); | |
llLinksetDataWrite("foobaa", "a"); | |
llLinksetDataWrite("woofie", "100"); | |
llLinksetDataWrite("fungus", "500"); | |
integer fooCount = llLinksetDataCountFound("^foo"); | |
integer count = llLinksetDataCountKeys(); | |
llOwnerSay("Added " + (string)count + " keys, " + (string)fooCount + " start with 'foo'"); | |
} | |
touch_start(integer count) { | |
if (llDetectedKey(0) != llGetOwner()) { return; } | |
// Delete keys starting with "foo"... | |
list res = llLinksetDataDeleteFound("^foo", ""); | |
integer deleteCount = llList2Integer(res, 0); | |
llOwnerSay("Deleted " + (string)deleteCount + " value(s) starting with foo"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment