HISE Logo Forum
    • Categories
    • Register
    • Login

    delete a property from an Object

    Scheduled Pinned Locked Moved Scripting
    3 Posts 2 Posters 150 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ulrikU
      ulrik
      last edited by

      In javascript I'm able to delete an Objects property by using

      delete Object.property;
      

      is there a similar operator for Hise script?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      1 Reply Last reply Reply Quote 0
      • d.healeyD
        d.healey
        last edited by d.healey

        I don't think there is such a method. In JUCE there is a removeProperty method that might do what you need if it was wrapped into the scripting API.

        Currently you have to do it the long way

        const obj = {"dog":"1", "cat":"2", "fish":"3", "duck":"4"};
        const toDelete = ["cat", "duck"];
        const newObj = {};
        
        for (x in obj)
            if (!toDelete.contains(x))
                newObj[x] = obj[x];
        
        Console.print(trace(newObj));
        

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        ulrikU 1 Reply Last reply Reply Quote 2
        • ulrikU
          ulrik @d.healey
          last edited by

          @d-healey thank you David

          Hise Develop branch
          MacOs 15.3.1, Xcode 16.2
          http://musikboden.se

          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          56

          Online

          1.7k

          Users

          11.7k

          Topics

          102.1k

          Posts