async function storeTokenLighting() {

      const tokenData = app.object.data;
      const tokenFlags = app.object.document;


      if (!(game.settings.get("LightsHUD", "preservePreviousLightData"))) {
        await tokenFlags.unsetFlag("LightsHUD", "initialLightData")
        return;
      };

      try {
        await tokenFlags.setFlag("LightsHUD", "initialLightData", await duplicate(tokenData.light));
      } catch (error) {
        LightsHUD.log("Error storing LightData: ", error);
        return;
      }

    }
// Store the initial status of illumination for the token to restore if all light sources are extinguished
Store the initial status of illumination for the token to restore if all light sources are extinguished
Store the initial status of illumination for the token to restore if all light sources are extinguished
async function storeTokenLighting() {
      const tokenData = app.object.data;
      const tokenFlags = app.object.document;
      if (!(game.settings.get("LightsHUD", "preservePreviousLightData"))) {
        await tokenFlags.unsetFlag("LightsHUD", "initialLightData")
        return;
      };
      try {
        await tokenFlags.setFlag("LightsHUD", "initialLightData", await duplicate(tokenData.light));
      } catch (error) {
        LightsHUD.log("Error storing LightData: ", error);
        return;
      }
    }
async function storeTokenLighting ( ) { const tokenData = app . object . data ; const tokenFlags = app . object . document ; if ( ! ( game . settings . get ( "LightsHUD" , "preservePreviousLightData" ) ) ) { await tokenFlags . unsetFlag ( "LightsHUD" , "initialLightData" ) return ; } ; try { await tokenFlags . setFlag ( "LightsHUD" , "initialLightData" , await duplicate ( tokenData . light ) ) ; } catch ( error ) { LightsHUD . log ( "Error storing LightData: " , error ) ; return ; } }
Store the initial status of illumination for the token to restore if all light sources are extinguished
Store the initial status of illumination for the token to restore if all light sources are extinguished