// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Distinguish a missing field from explicit null // Not compiled or tested in-world // Setup: Edit DOCUMENT and the example settings, then touch as owner. Requires simulator support for LSL JSON functions. // Stop / restore: Remove or disable. JSON changes occur only in a local preview string. // Notes: These states can have different configuration meanings. This example reports the distinction without choosing a fallback automatically. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. string DOCUMENT="{\"label\":\"\",\"subtitle\":null}"; string FIELD="label"; default { touch_start(integer touches) { if(llDetectedKey(0)!=llGetOwner())return; string kind=llJsonValueType(DOCUMENT,[FIELD]); if(kind==JSON_INVALID)llOwnerSay("Field absent."); else if(kind==JSON_NULL)llOwnerSay("Field explicitly null."); else if(kind==JSON_STRING && llJsonGetValue(DOCUMENT,[FIELD])=="")llOwnerSay("Field is an intentional empty string."); else llOwnerSay("Field exists with a non-null value."); } changed(integer flags) { if(flags & CHANGED_OWNER)llResetScript(); } }