synth

Forum Replies Created

Viewing 15 posts - 21 through 35 (of 35 total)
  • Author
    Posts
  • synth
    Participant
      • Topics: 13
      • Replies: 35
      • Total: 48

      Oh ok. Is the Ctrlr state then written to disk immediately somewhere, in case there is a crash after a change in a lua method ? (very common during development :P)

      in reply to: Debugging Support for Lua #30160
      synth
      Participant
        • Topics: 13
        • Replies: 35
        • Total: 48

        I see that you added luasocket in https://github.com/RomanKubiak/ctrlr/commit/86a1b7e21dc2e40e535b71990126f5230b681dff

        I am yet to test this out, but does the debug library show stack traces and allow stepping through the code in Ctrlr now ?

        in reply to: How do I add lua extensions/libraries to the Ctrlr Lua version ? #29579
        synth
        Participant
          • Topics: 13
          • Replies: 35
          • Total: 48

          Yeah actually it was friend of mine. We are both using Ctrlr 🙂

          I ll send in a request too.

          synth
          Participant
            • Topics: 13
            • Replies: 35
            • Total: 48

            Wow thanks atom 🙂 ! I ll test it out today.

            If I want to contribute to Ctrlr through C/C++ code and lua, then do I need to fork your repo in Github ? Then do commits in the fork and initiate pull requests for you ?

            in reply to: LSlider:setValue() does not have NotificationType exposed #29516
            synth
            Participant
              • Topics: 13
              • Replies: 35
              • Total: 48

              Thanks so much.

              in reply to: Debugging Support for Lua #29498
              synth
              Participant
                • Topics: 13
                • Replies: 35
                • Total: 48

                I was wondering if an external editor with remote debugging capabilities like ZeroBrane https://studio.zerobrane.com/features.html

                …could be supported by Ctrlr. Zerobrane has the ability to connect to a running Lua interpreter that has debugging support. If the Lua interpreter itself is compiled with Lua debugging support then it opens a socket to which an external debugger can connect.

                So the idea would be that breakpoints are set in the Lua code in an external debugger. Then when the breakpoints are hit then the lua interpretor is frozen in Ctrlr and the user can examine the stack, variables etc.

                The source code info would need to be conveyed to the external debugger of course so we would need the source code to be available in a file. Perhaps the lua methods for a panel can be read from a .lua file instead of being read from the .panel file. Then this file can simply be dropped into the external IDE/debugger.

                Furthermore code editing can be done there too and whenever the user saves the file, the file can be compiled into Ctrlr by CtrlrLuaManager.

                Of course before this we need to move Ctrlr to LuaJIT.

                in reply to: ThreadWithProgressWindow's setThreadFunction is failing #29452
                synth
                Participant
                  • Topics: 13
                  • Replies: 35
                  • Total: 48

                  Thanks Atom,

                  It works well. I am bit newbie for Lua, Hope to catch up soon with it as well.

                  in reply to: addItem() of JUCE not exposed to Lua ? #29238
                  synth
                  Participant
                    • Topics: 13
                    • Replies: 35
                    • Total: 48

                    Thanks !

                    in reply to: Pass StringArray back to C++ #29221
                    synth
                    Participant
                      • Topics: 13
                      • Replies: 35
                      • Total: 48

                      Thanks it works now. Do you know if we can pass native arrays back end forth.

                      Like if we have a C++ function which returns an array of doubles :

                      double[] doTask(void)

                      Can we call this in Lua and receive the array ? Or do we need to put the doubles in a StringArray and return that ?

                      in reply to: Pass StringArray back to C++ #29157
                      synth
                      Participant
                        • Topics: 13
                        • Replies: 35
                        • Total: 48

                        ok, so I have tried. The problem is that when I return a StringArray from C++(not a StringArray & ), then it does get created in the lua side as expected. But I cant read its values using :

                        sa = obj:callback()
                        val = sa:get(0)
                        ERROR: No matching overload found, candidates:
                        String get(custom [class LStringArray]&,int)

                        If you have a function in C++ side that returns a StringArray then are you able to read out the values in the StringArray using get() after you call the function ?

                        • This reply was modified 9 years, 7 months ago by synth.
                        in reply to: Pass StringArray back to C++ #29154
                        synth
                        Participant
                          • Topics: 13
                          • Replies: 35
                          • Total: 48

                          oh wait, I did not see your reply, reading it now 🙂

                          ————–

                          ok, you are right I should not be passing back references from C++ into Lua. If the object is destroyed in the C++ side by any chance, then lua might still have that reference and cause a crash if its used in lua code.

                          So yeah I ll try now with :
                          StringArray callback(void) {….}

                          • This reply was modified 9 years, 7 months ago by synth.
                          in reply to: Pass StringArray back to C++ #29153
                          synth
                          Participant
                            • Topics: 13
                            • Replies: 35
                            • Total: 48

                            I think I understand whats happening here.

                            The JUCE StringArray class allows access to its data through overloading the [] operator. It does not provide a StringArray::get() , so you have provided one via LStringArray::get() in LString.cpp

                            class_<StringArray, LStringArray>("StringArray")
                            			.def(constructor<>())
                            			.def(constructor<const String &>())
                            			.def(constructor<const char *const *, const int>())
                            			.def(constructor<const char *const *>())
                            			.def("size", &StringArray::size)
                            			.def("get", &LStringArray::get)
                            			.def("contains", &StringArray::contains)
                            			....

                            Thats fine. But if I were to return a StringArray from a C++ function :
                            const StringArray& testArray(const StringArray& arr);

                            Its not recognized in lua.

                            So I solved it by exposing StringArray::operator[] in LString.cpp :

                            class_<StringArray, LStringArray>("StringArray")
                            			.def(constructor<>())
                            			.def(constructor<const String &>())
                            			.def(constructor<const char *const *, const int>())
                            			.def(constructor<const char *const *>())
                            			.def("size", &StringArray::size)
                                                    .def("getAt", &StringArray::operator[])    <-----------
                            			.def("get", &LStringArray::get)
                            			.def("contains", &StringArray::contains)
                            in reply to: Pass StringArray back to C++ #29145
                            synth
                            Participant
                              • Topics: 13
                              • Replies: 35
                              • Total: 48

                              Well I checked the declaration of the C++ function again and it seems I need to make it as :

                              bool callback(const StringArray& arr) {….}

                              Now I am able to receive String arrays sent from Lua into C++.

                              Lets say I want to send a StringArray from C++ to Lua. Thats where I am stuck now:
                              If I have a C++ function like :

                              const StringArray& callback(<strong>const </strong>StringArray& arr) 
                              { return m_saTest; }

                              This returns a StringArray to Lua. But am not able to read this StringArray in Lua:
                              sa = callback(testArray);
                              console(String(sa:get(1)))

                              Error !!

                              in reply to: Adding new C++ class to Ctrlr and exposing through Lua #28469
                              synth
                              Participant
                                • Topics: 13
                                • Replies: 35
                                • Total: 48

                                ok its working now. Some weird linking error from the VST project.

                                in reply to: Adding new C++ class to Ctrlr and exposing through Lua #28456
                                synth
                                Participant
                                  • Topics: 13
                                  • Replies: 35
                                  • Total: 48

                                  That was a parsing error in the forum. Here are the files again in code tags:

                                  cpp:

                                  
                                  #include "stdafx.h"
                                  #include "Test.h"
                                  
                                  void Test::wrapForLua (lua_State *L)
                                  {
                                      using namespace luabind;
                                  
                                      module(L)
                                      [
                                          class_<Test>("Test")
                                              .def(constructor<uint32>())
                                              .def("getValue", &getValue)
                                      ];
                                  }
                                  

                                  Header:

                                  #ifndef __TEST__
                                  #define __TEST__
                                  
                                  #include "CtrlrLuaManager.h"
                                  
                                  class Test
                                  {
                                      public:
                                          Test(int i) {}
                                          int getValue() const { return 5; }
                                  
                                          static void wrapForLua (lua_State *L);
                                  
                                    
                                  };
                                  
                                  #endif

                                  The template parameters are there, but I still get the error. Just try dropping them in Source/Lua/JUCEClasses , you will see it.

                                  • This reply was modified 9 years, 8 months ago by synth.
                                  • This reply was modified 9 years, 8 months ago by synth.
                                  • This reply was modified 9 years, 8 months ago by synth.
                                Viewing 15 posts - 21 through 35 (of 35 total)
                                Ctrlr