HISE Logo Forum
    • Categories
    • Register
    • Login

    Comparison Fails?

    Scheduled Pinned Locked Moved Solved Scripting
    12 Posts 4 Posters 124 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.
    • clevername27C
      clevername27
      last edited by clevername27

      Does anyone know why this works?

      local num = 32;
      if (dataPart.length < num) // Do something.
      

      …but not this:

      if (dataPart.length < 32) // Do something.
      

      Error message is: Unknown function 'length'.

      Cheers.

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

        What is dataPart?

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

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

          @clevername27 said in Comparison Fails?:

          …but not this (Unknown function 'length'):

          Show me a screenshot of where you're using it in your code?

          I think the clue might be in the word "function".

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

          clevername27C 1 Reply Last reply Reply Quote 1
          • clevername27C
            clevername27 @d.healey
            last edited by

            @d-healey

            78d79c44-c99c-46ec-bc7e-9696170af45e-image.png

            vs

            d870f95d-a385-4906-b65e-225cf5f0421e-image.png

            Thanks, man.

            dataPart is a string, though I don't see why it would matter?

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

              Weird that it says function, I thought it was going to be a typo like length() but nope...

              One thing I've found very useful in HISE lately is type safety, it helps me avoid a lot of simple bugs. Try adding it to your function, that way it will alert you if at any time you are passing the wrong data type to the function.

              inline function RestoreStateOfEQ(eqModule, dataPart: string) {
              // etc
              }
              

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

              clevername27C SimonS Matt_SFM 4 Replies Last reply Reply Quote 2
              • clevername27C
                clevername27 @d.healey
                last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • clevername27C
                  clevername27 @d.healey
                  last edited by

                  @d-healey That did it! Thanks!!!!!

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

                    @clevername27 There's a good doc for it, and I have a video on the way

                    Link Preview Image
                    HISE | Docs

                    favicon

                    (docs.hise.audio)

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

                    clevername27C 1 Reply Last reply Reply Quote 2
                    • SimonS
                      Simon @d.healey
                      last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • clevername27C
                        clevername27 @d.healey
                        last edited by

                        @d-healey Of course you do. 💯

                        1 Reply Last reply Reply Quote 0
                        • clevername27C clevername27 marked this topic as a question on
                        • clevername27C clevername27 has marked this topic as solved on
                        • Matt_SFM
                          Matt_SF @d.healey
                          last edited by

                          @d-healey Type safety. I can't believe I spend half of my time in the docs and missed this particular chapter 🤦
                          Thank you!

                          Develop branch
                          Win10 & VS17 / Ventura & Xcode 14. 3

                          d.healeyD 1 Reply Last reply Reply Quote 2
                          • d.healeyD
                            d.healey @Matt_SF
                            last edited by

                            @Matt_SF it's a fairly recent addition

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

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

                            46

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            101.9k

                            Posts