From 78c4f41f2815ad504624d175b6bcc901002f4922 Mon Sep 17 00:00:00 2001 From: Samantha Wright Date: Thu, 3 Oct 2024 18:42:10 -0700 Subject: [PATCH] safer macro for deleting power loads --- ARES/api/status.h.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARES/api/status.h.lsl b/ARES/api/status.h.lsl index 1ca1f8d..dcdf8b7 100644 --- a/ARES/api/status.h.lsl +++ b/ARES/api/status.h.lsl @@ -61,7 +61,7 @@ // create/modify or remove a power load: #define set_power_load(_device, _load_name, _wattage) setdbl("chassis", ["load", _device + "__" + _load_name], (string)_wattage) -#define delete_power_load(_device, _load_name) deletedbl("chassis", ["load", _device + "__" + _load_name]) +#define delete_power_load(_device, _load_name) { if(getdbl("chassis", ["load", _device + "__" + _load_name]) != JSON_INVALID) deletedbl("chassis", ["load", _device + "__" + _load_name]); } // (remember to trigger a status update afterward, as described in the comment above) #define status_update() e_call(C_STATUS, E_SIGNAL_CALL, NULL_KEY + " " + NULL_KEY + " status update");