No announcement yet.

Load CSV Data Quickly - No Grids.

  • Filter
  • Time
  • Show
Clear All
new posts

  • Load CSV Data Quickly - No Grids.

    I've been working to make my program run more efficiently and I found running with Grids is highly inefficient. The solution I found is turning a file into a giant string and reduce it down by line then handling each line. After a crash course in LUA, I came up with this partially stolen from not sure where and some of my own logic, solution. I'm dropping this here along with the logic behind it.. hope this may be of some help to someone. By the way I'm that annoying guy that doesn't use tabs.. in fact I even remove them!

    string = TextFile.ReadToString("AutoPlay\\Data\\Data.csv"); --Loading File to String
    local Table = {};
    for line in string.gmatch(string, '([^\r\n]+)' ) do --Breaking down line by line....
    for delimit in string.gmatch(line, '([^,]+)' ) do -- Breaking down each line by delimiter
    Table[#Table + 1] = delimit; -- Taking the delimited data and putting it into a table
    ListBox.AddItem("Listbox1", Table[1], Table[2] ); -- Doing stuff with my table.
    Active = {}; -- Rinse and Repeat!

  • #2
    This is amazing, Thanks Grimsley11 , One of my project depends on CSV files and this will make a huge help for me