Can i use Table.Concat like this ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • qwerty
    Forum Member
    • Oct 2006
    • 345

    Can i use Table.Concat like this ?

    i find myself in the situation where i want to loop through a table reading the data from every other line in the table into a list box, so i was thinking to try using Table.Concat with no separator declared, and a matching index for the start and stop points.... would this effectively allow me to read just that one line ?


    here is what i have so far

    Code:
    	-- Transfer from chunkTable to List Box --
    item_count = Table.Count(chunkTable);
    ind = 1;
    ListBox.DeleteItem("FileSizeList", LB_ALLITEMS);
    for x = 1, (item_count/2) do
    	ListBox.InsertItem("FileSizeList", x, "Piece ".. x, Table.Concat(chunkTable, "", ind, ind));
    	ind = ind+2;
    	ListBox.SetUpdate("FileSizeList", true);
    end
    i'm not entirely sure if i need to use the SetUpdate thing or not, i only really need it to update at the end of the loop, but if it takes a while to populate then updating on each step could be handy

    i also have the same data in a text file, but thought it might be easier to do it this way from the table
  • yosik
    Indigo Rose Customer
    • Jun 2002
    • 1856

    #2
    FYI, in the for statement, you can use step. Wouldn't that be easier?
    Yossi

    Comment

    • qwerty
      Forum Member
      • Oct 2006
      • 345

      #3
      sorry, you lost me i'm afraid .... but i did find an alternitive way of doing it...

      in the original table, when it was created, there was a number of aditional characters and things in each index which i did not need, or wanted to change, so when i was creating the original table in the function i use for that, i make it create a second table with only the data i needed in each element plus the aditional text i wanted, so now i can use this

      Code:
      	-- Transfer Data from chunkSizeTable to List Box --
      item_count = Table.Count(chunkSizeTable);
      ListBox.DeleteItem("FileSizeList", LB_ALLITEMS);
      for j,k in chunkSizeTable do
      	ListBox.InsertItem("FileSizeList", j, "Piece ".. j, k);
      	ListBox.SetUpdate("FileSizeList", true);
      end

      Comment

      • Desrat
        Forum Member
        • Nov 2006
        • 240

        #4
        Use a loop with a step is what yosik was suggesting

        Code:
        -- A for loop that counts from 1 to 10 in 2's
        min = 0;  -- The number to start at
        max = 10;  -- The number to stop at
        step = 2;  -- The number to count by (in this case 0, 2, 4, ...)
        for count = min, max, step do
        	-- Do something here
        end

        Comment

        • qwerty
          Forum Member
          • Oct 2006
          • 345

          #5
          ok now i'm with you

          and yes, that would have worked better than what i had, but writing a second table on the fly with the first one has actually allowed me to alter the way i display the data which is better for me live and learn as they say


          ok, so thats this one solved ... appreciate the help guys, and i will certainly remember this for next time


          now to find out why my File.GetSize action is returning a value lower than 250mb when applied to a 4.09gb img file :(... back to the search engine i go !

          Comment

          Working...
          X