Trying to use unregistered class

Home Forums General Programming Trying to use unregistered class

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39696
    pascalc
    Participant
      • Topics: 7
      • Replies: 27
      • Total: 34

      Hi,

      In my panel I have an array of MemoryBlocks.

      I am trying to loop over these and append them all to a file:

      for i, data in ipairs(splitData) do
        if f:appendData(data:getData(), data:getSize()) == false then
          utils.warnWindow ("File write", "Sorry, the Editor failed to\nwrite the data to file!")
        end
      end

      The data:getData() functions fail though:

      Name: getData
      Error message: std::runtime_error: 'Trying to use unregistered class'

      I see that someone else on this forum had the same issue: http://ctrlr.org/forums/topic/simple-akai-s2000-frontend/page/2/

      I’m really a newbie when it comes to Lua but what I grasp from this SO: http://stackoverflow.com/questions/12031366/luabind-trying-to-use-unregistered-class-on-return it could be something in the Ctrlr MemoryBlock class and LuaBind.

      I looked in the Ctrlr source code and the getData() function is commented out in LMemoryBlock.h. Could this be a potential problem?

      Any help is much appreciated!

      BR
      /Pascal

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

        what’s the type of splitData (is it a lua table of MemoryBlocks ?) you can always try to see what type “data” is just use what(data) or the built in debugger (that’s what it’s for)

        #39965
        pascalc
        Participant
          • Topics: 7
          • Replies: 27
          • Total: 34

          Thanks,

          This is the output of the program when I add the line you suggested right after the for line, before the if statement:

          LUA>> Object type [MemoryBlock]
          -----------------------------------------------------------------
          
          Members:
          	                       getData:	function
          	                   setBitRange:	function
          	                       getByte:	function
          	             loadFromHexString:	function
          	                   toHexString:	function
          	               insertIntoTable:	function
          	                       setSize:	function
          	                      fillWith:	function
          	                        insert:	function
          	                       setByte:	function
          	                       getSize:	function
          	                      getRange:	function
          	                 removeSection:	function
          	               createFromTable:	function
          	                      swapWith:	function
          	                    ensureSize:	function
          	                   getBitRange:	function
          	                        copyTo:	function
          	                   replaceWith:	function
          	                        __init:	function
          	                      copyFrom:	function
          	                      toString:	function
          	                        append:	function
          	            fromBase64Encoding:	function
          	              toBase64Encoding:	function
          	                    toLuaTable:	function
          
          Attributes:
          
          -----------------------------------------------------------------
          LUA>> Object type [MemoryBlock]
          -----------------------------------------------------------------
          
          Members:
          	                       getData:	function
          	                   setBitRange:	function
          	                       getByte:	function
          	             loadFromHexString:	function
          	                   toHexString:	function
          	               insertIntoTable:	function
          	                       setSize:	function
          	                      fillWith:	function
          	                        insert:	function
          	                       setByte:	function
          	                       getSize:	function
          	                      getRange:	function
          	                 removeSection:	function
          	               createFromTable:	function
          	                      swapWith:	function
          	                    ensureSize:	function
          	                   getBitRange:	function
          	                        copyTo:	function
          	                   replaceWith:	function
          	                        __init:	function
          	                      copyFrom:	function
          	                      toString:	function
          	                        append:	function
          	            fromBase64Encoding:	function
          	              toBase64Encoding:	function
          	                    toLuaTable:	function
          
          Attributes:
          
          -----------------------------------------------------------------
          
          At line [-1]: [C]
          What: C
          Namewhat: method
          Name: getData
          Error message: std::runtime_error: 'Trying to use unregistered class'

          The weird thing is that I get two printouts (there are a lot more elements in the table)

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

            appendData should be taking MemoryBlock as a parameter not pointers, i need to fix that and i’ll post a fix asap

          Viewing 4 posts - 1 through 4 (of 4 total)
          • The forum ‘Programming’ is closed to new topics and replies.
          There is currently 0 users and 134 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