Advice before starting the project.

Home Forums General Programming Advice before starting the project.

Viewing 20 posts - 21 through 40 (of 55 total)
  • Author
    Posts
  • #3641
    atom
    Keymaster
      • Topics: 159
      • Replies: 2945
      • Total: 3104
      • ★★★★★

      There might be more bugs like that in the LUA code, at first i wanted to use the String class but some problems occured with that and i had to fall back to std::string so there might be more stuff like that in the code, i’ll what i can find and post a build asap.

      But the code there works, you just need to pass a String class as the parameters
      [code:thzmr075]
      f = utils.saveFileWindow (String("Save File"), File(""), String("*.syx"), true)
      [/code:thzmr075]

      #3642
      Tronic
      Participant
        • Topics: 7
        • Replies: 45
        • Total: 52

        As always, thank you.
        functions you posted work well.

        To pass data to the file to be saved, the only method I’ve found is = ‘data: loadFromHexString ("f0 00 f7")’
        other options?

        another question, but the functions table.insert, table.remove, table.sort etc. are not present?

        Then when ready will post my work.

        #3643
        atom
        Keymaster
          • Topics: 159
          • Replies: 2945
          • Total: 3104
          • ★★★★★

          I think the LUA native stuff should work so the string. table. math and others are there. If it’s not working let me know i’ll give it a check.
          If you want to write something to the file you need to do it on the file object in your case
          [code:1dpbf872]
          f = utils.saveFileWindow (String("Save File"), File(""), String("*.syx"), true)
          if f:existsAsFile() then
          f:replaceFileContentWithData(data)
          end
          [/code:1dpbf872]
          Other file methods are described here http://www.rawmaterialsoftware.com/juce … sFile.html like i wrote on the API Docs page, api/class_ctrlr_lua_file.html#af5b2054af101fc9bd1663c40a9e71b5f

          #3644
          Tronic
          Participant
            • Topics: 7
            • Replies: 45
            • Total: 52

            atom I confirm that I was unable to have the ability to manage the table, with the functions sort, insert, and so on.
            I take this opportunity to ask another question:
            how to prevent a lua function is executed when you start the application?
            I have assigned the lua function to the modulator, it is immediately executed when the application starts.

            #3645
            atom
            Keymaster
              • Topics: 159
              • Replies: 2945
              • Total: 3104
              • ★★★★★

              It will always execute since at the start the modulator needs to have an assigned value and that causes the LUA method to execute (since it’s linked to the modulator value changed event).

              #3646
              dasfaker
              Keymaster
                • Topics: 80
                • Replies: 793
                • Total: 873
                • ★★★

                Create a method and put it on the panel option "Called before any modulators are created". In this method set a variable (p.e. [i:5n4tuo9b]panelLoaded = 0[/i:5n4tuo9b])

                Put this variable at the beginning of the method , and if the variable is true the method is executed, otherwise not.
                [i:5n4tuo9b]

                — Called when a modulator value changes

                method = function(modulator, newValue)
                If panelLoaded = 1 then
                method
                end[/i:5n4tuo9b]

                Then you can set to true this variable when you need it, may be when the panel has finished loading or at the press of a button, and from this moment the method will be executed when the modulator is called.

                #3647
                Tronic
                Participant
                  • Topics: 7
                  • Replies: 45
                  • Total: 52

                  @dasfaker
                  thanks, it works
                  I had not thought about this possibility.

                  #3648
                  dasfaker
                  Keymaster
                    • Topics: 80
                    • Replies: 793
                    • Total: 873
                    • ★★★

                    Hi Atom

                    When I try to open a file and the open file window pop up, pressing Cancel (so I don’t open any file) crash Ctrlr. Otherwise works fine.

                    I’m using the code you posted here

                    [code:2nbn7olf]f = utils.openFileWindow ("open file", File(""), "*.*", true)
                    data = f:loadFileAsData()
                    — data is a CtrlrLuaMemoryBlock with the contents of the file
                    console (data:toHexString(1))[/code:2nbn7olf]

                    #3649
                    Tronic
                    Participant
                      • Topics: 7
                      • Replies: 45
                      • Total: 52

                      this code works well for me, even if I press cancel,
                      but the large files, passed to the console output, freeze CTRLR.
                      instead seems to load fine without assigning them to the console output.
                      buffer console too small?

                      #3650
                      atom
                      Keymaster
                        • Topics: 159
                        • Replies: 2945
                        • Total: 3104
                        • ★★★★★

                        Well i don’t think that printing loads of data to the console is a good idea it’s a simple component that console.

                        As for the crash i know why it’s happening you get and invalid file and trying to write to it so that will crash, always check if the file is valid and writable before writing to it.

                        #3651
                        Tronic
                        Participant
                          • Topics: 7
                          • Replies: 45
                          • Total: 52
                          "Tronic":25ajj46r wrote:
                          I was unable to have the ability to manage the table, with the functions sort, insert, and so on.
                          [/quote:25ajj46r]
                          added this to bug list [LINK][/url:25ajj46r]
                          #3652
                          atom
                          Keymaster
                            • Topics: 159
                            • Replies: 2945
                            • Total: 3104
                            • ★★★★★

                            I don’t see the problem it works for me in the console
                            [code:2sh0hyyp]
                            >>> t = { 3,2,5,1,4 }

                            >>> table.sort (t, function(a,b) return a<b end)

                            >>> console (table.concat(t, ", "))
                            1, 2, 3, 4, 5
                            [/code:2sh0hyyp]

                            #3653
                            Tronic
                            Participant
                              • Topics: 7
                              • Replies: 45
                              • Total: 52

                              This is the error I get
                              [code:vcbxvife]ERROR: [string "t = { 3,2,5,1,4 }..."]:2: attempt to call field ‘sort’ (a nil value)[/code:vcbxvife]

                              maybe I forgot to specify that I use the WINDOWS version
                              tested on both the 32bit and the 64bit

                              #3654
                              atom
                              Keymaster
                                • Topics: 159
                                • Replies: 2945
                                • Total: 3104
                                • ★★★★★

                                it doesn’t matter what version/os you use LUA is the same. Can you paste the code you are typing in ?

                                #3655
                                Tronic
                                Participant
                                  • Topics: 7
                                  • Replies: 45
                                  • Total: 52

                                  this or as your I get this
                                  [code:1zh8ch0v]>>> t = { 3,2,5,1,4 }
                                  table.sort (t, function(a,b) return a<b end)
                                  console (table.concat(t, ", "))
                                  ERROR: [string "t = { 3,2,5,1,4 }..."]:2: attempt to call field ‘sort’ (a nil value)[/code:1zh8ch0v]

                                  #3656
                                  atom
                                  Keymaster
                                    • Topics: 159
                                    • Replies: 2945
                                    • Total: 3104
                                    • ★★★★★

                                    I don’t know how can this not work, i typed this in the console, either in per-line or as a whole and it works, and i’m also on windows7 x64
                                    [code:3gqsks4i]

                                    >>> t = { 3,2,5,1,4 }

                                    >>> table.sort (t, function(a,b) return a<b end)

                                    >>> console (table.concat(t, ", "))
                                    1, 2, 3, 4, 5

                                    >>> t = { 3,2,5,1,4 }
                                    table.sort (t, function(a,b) return a<b end)
                                    console (table.concat(t, ", "))
                                    1, 2, 3, 4, 5
                                    [/code:3gqsks4i]

                                    #3657
                                    dasfaker
                                    Keymaster
                                      • Topics: 80
                                      • Replies: 793
                                      • Total: 873
                                      • ★★★

                                      It’s working here on Win XP, rev 919

                                      #3658
                                      Tronic
                                      Participant
                                        • Topics: 7
                                        • Replies: 45
                                        • Total: 52

                                        <img decoding=” title=”Sad” />
                                        I’m on Win7 x64

                                        ideas about what I could do to understand why it does not work on my system?

                                        #3659
                                        atom
                                        Keymaster
                                          • Topics: 159
                                          • Replies: 2945
                                          • Total: 3104
                                          • ★★★★★

                                          I have no idea, this does not depend on the OS LUA is built into the Ctrlr binary.

                                          #3660
                                          Tronic
                                          Participant
                                            • Topics: 7
                                            • Replies: 45
                                            • Total: 52

                                            possible dependence of some framework 3.5 or 4?

                                          Viewing 20 posts - 21 through 40 (of 55 total)
                                          • The forum ‘Programming’ is closed to new topics and replies.
                                          There is currently 0 users and 62 guests online
                                          No users are currently active
                                          Forum Statistics
                                          Threads: 2,495, Posts: 17,374, Members: 77,605
                                          Most users ever online was 12 on January 22, 2019 3:47 pm
                                          Ctrlr