feat(settings.lsl): begin implementation of settings module

This commit is contained in:
zontreck 2024-10-04 03:19:54 -07:00
parent d141d5412f
commit c34283eb35
5 changed files with 60 additions and 0 deletions

View file

@ -0,0 +1,24 @@
LM(integer iSignal, string sOp, string sJsonArgs) {
string sJson = llJsonSetValue(sJsonArgs, ["op"], sOp);
llMessageLinked(LINK_SET, iSignal, llJsonSetValue(sJson, ["script"], llGetScriptName()), "");
}
WriteSetting(string sKey, string sValue) {
llLinksetDataWrite(sKey, sValue);
SendSetting(sKey, sValue);
}
ReadSetting(string sKey) {
string sVal = llLinksetDataRead(sKey);
if(sVal == "") {
NoSetting(sKey);
}else SendSetting(sKey, sVal);
}
SendSetting(string sKey, string sVal) {
LM(LINK_SIGNAL_SETTINGS, OP_SETTINGS_RESPONSE, llList2Json(JSON_OBJECT, ["key", sKey, "value", sVal]));
}
NoSetting(string sKey) {
LM(LINK_SIGNAL_SETTINGS, OP_SETTINGS_EMPTY, llList2Json(JSON_OBJECT, ["key", sKey]));
}

View file

@ -0,0 +1,7 @@
integer LINK_SIGNAL_SETTINGS = 0904241;
string OP_SETTINGS_WRITE = "settings_write";
string OP_SETTINGS_READ = "settings_read";
string OP_SETTINGS_REQUEST = "settings_req";
string OP_SETTINGS_RESPONSE = "settings_resp";
string OP_SETTINGS_RESPONSE = "settings_empty";

0
src/includes/Version.lsl Normal file
View file