string.format – Setting Patch Name

Home Forums General Programming string.format – Setting Patch Name

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #630
    Cramp
    Participant
      • Topics: 11
      • Replies: 66
      • Total: 77

      hi,
      at last I get into SysEX export/import with my NL3 panel.
      I can export/import but still there are issues during the test with hardware. But I think it can be solved )

      ok, I used the code taken as example from Virus TI panel – thanks to author – really helps me to get a lot of things

      But I stuck with this one.

      The patch name 16 characters starts from 7 byte so my programName range is (7,23)

      ok there is a Load button which supposed to be loading SysEx files. it loads fine – setting modulators values but..
      I can not display the patch name properly on uiLabel.

      So this is my code
      [code:y4xvp0xt]symbols = {"|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|","|"," ","!"," ","#","$","%","&","’","(",")","*","+","4","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","b","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~"}

      a = symbols[programName:getByte(7)]
      b = symbols[programName:getByte(8)]
      c = symbols[programName:getByte(9)]
      d = symbols[programName:getByte(10)]
      e = symbols[programName:getByte(11)]
      f = symbols[programName:getByte(12)]
      g = symbols[programName:getByte(13)]
      h = symbols[programName:getByte(14)]
      i = symbols[programName:getByte(15)]
      j = symbols[programName:getByte(16)]
      k = symbols[programName:getByte(17)]
      l = symbols[programName:getByte(18)]
      m = symbols[programName:getByte(19)]
      n = symbols[programName:getByte(20)]
      o = symbols[programName:getByte(21)]
      p = symbols[programName:getByte(22)]

      text = string.format("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p)
      patchName = panel:getModulatorByName("PatchNameBox")
      if patchName ~= nil then
      c = patchName:getComponent()
      c:setPropertyString ("uiLabelText", text)
      end
      [/code:y4xvp0xt]

      what does %s do for text in string.format? how to display the full 16 character of the patchname?

      another thing I would like to clarify how to merge 2 strings data.
      For example,
      [code:y4xvp0xt]text1 = "filename"
      text2 = ".syx"
      [/code:y4xvp0xt]
      is it possible to do like [code:y4xvp0xt]text = text1 + text2[/code:y4xvp0xt]

      Many thanks

      #4475
      romsom
      Participant
        • Topics: 3
        • Replies: 27
        • Total: 30

        [url:1hw6tk8u]http://lua-users.org/wiki/StringLibraryTutorial[/url:1hw6tk8u]

        also if you still need this:

        [code:1hw6tk8u]text = text1 .. text2[/code:1hw6tk8u]

        …not that hard to google…

        Good Night <img decoding=” title=”Wink” />

        #4476
        Cramp
        Participant
          • Topics: 11
          • Replies: 66
          • Total: 77
          "romsom":ejyq5gk2 wrote:
          [url:ejyq5gk2]http://lua-users.org/wiki/StringLibraryTutorial[/url:ejyq5gk2]

          also if you still need this:

          [code:ejyq5gk2]text = text1 .. text2[/code:ejyq5gk2]

          …not that hard to google…

          Good Night <img decoding=” title=”Wink” />[/quote:ejyq5gk2]

          thanks mate, I was Googling but seems I did it wrong =)

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