Forum
    • Categories
    • Register
    • Login

    call function inside function

    Scheduled Pinned Locked Moved Scripting
    14 Posts 3 Posters 1.0k 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 @David Healey
      last edited by

      @d-healey So how do I set it up, do you have a short example where both functions use the same "private" variables?

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

      1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey
        last edited by David Healey

        There are no private variables in javascript or HISE script. But in HISE script we can create variables that have scope limited to a namespace.

        namespace MyNamespace
        {
            reg myVariable = 50;
        
            inline function aFunction()
            {
                Console.print(myVariable); // Will print 50 to the console
            }
        }
        
        Console.print(MyNamespace.myVariable); // Will print 50 to the console
        Console.print(myVariable);  // Will trigger undefined parameter error�
        

        Note that the variables must be of type reg or const to limit the scope. var will always be global.

        More info here:
        https://forum.hise.audio/topic/92/namespaces-in-javascript
        https://github.com/davidhealey/hise_documentation/blob/master/scripting/scripting-in-hise/hise-script-coding-standards.md

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ulrikU 1 Reply Last reply Reply Quote 2
        • ulrikU
          ulrik @David Healey
          last edited by

          @d-healey Thank you David, I will study :)

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

          1 Reply Last reply Reply Quote 1
          • Christoph HartC
            Christoph Hart
            last edited by

            @d-healey if you create a pull request for the coding standard, I'll merge it into the main doc branch so it becomes part of the HISE doc website.

            David HealeyD 1 Reply Last reply Reply Quote 1
            • David HealeyD
              David Healey @Christoph Hart
              last edited by

              @Christoph-Hart Done, thanks!

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              1 Reply Last reply Reply Quote 0
              • Christoph HartC
                Christoph Hart
                last edited by

                Ah damn, I noticed you were using a Markdown feature that the HISE Markdown parser is not supporting (inline code examples in a bullet list):

                -   This list item has a code example:
                
                    ```javascript
                    CodeExample
                    ```
                
                -   Next Item
                

                This makes it look like this in the HISE doc browser:

                256189cb-6584-44fc-b53e-9b358e2d2009-image.png

                With a bit of whitespace correction it looks like this:

                c8bb3538-f291-4072-b713-3167826b6793-image.png

                However then it might not look as good in the Github preview. Hard choice :)

                David HealeyD 1 Reply Last reply Reply Quote 0
                • David HealeyD
                  David Healey @Christoph Hart
                  last edited by

                  @Christoph-Hart I think it's more important that it looks good in the HISE docs since that's where I expect most users will find it. Do you want me to clean it up?

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    Nope, I'll do it, I have to add the metadata and stuff anyways. It's a pretty quick thing...

                    1 Reply Last reply Reply Quote 1
                    • Christoph HartC
                      Christoph Hart
                      last edited by

                      Alright here we go:

                      https://docs.hise.audio/scripting/scripting-in-hise/hise-script-coding-standards.html

                      I noticed that in some examples it uses 2 spaces instead of a tab (=4 spaces) now. Should be an easy fix though :)

                      David HealeyD 1 Reply Last reply Reply Quote 3
                      • David HealeyD
                        David Healey @Christoph Hart
                        last edited by

                        @Christoph-Hart Thank you!

                        Free HISE Bootcamp Full Course for beginners.
                        YouTube Channel - Public HISE tutorials
                        My Patreon - HISE tutorials

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

                        32

                        Online

                        2.1k

                        Users

                        13.0k

                        Topics

                        113.0k

                        Posts