Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    16

    Tables and files

    Hi.
    Now I had another problem. I create a table like the follow:
    Code:
    new_table = {};
    new_table[1] = {item1="Item 1", item2="Item 2", item3="Item 3"};
    new_table[2] = {item1="Item 4", item2="Item 5", item3="Item 6"};
    and use
    Code:
    TextFiles.WriteFromTable("C:\\TestTable.txt", new_table, false);
    to write the table to a file, but I get a 0 Kb file. While using
    Code:
    TextFiles.WriteFromTable("C:\\TestTable.txt", new_table[1], false);
    I get the trick, but of course write only the element [1] of the new_table.

    I'm totally newbie and I think the problem is that I create
    a table for each new_table element, right?
    Can someone help me?

    Thanks
    xry

  2. #2
    Join Date
    Apr 2006
    Posts
    127
    Yes, essentially what you are doing there is creating tables within a table. This is permitted by Lua Script but apparently not supported by the AMS WriteFromTable function, so you need to use a loop and write to file (append) from each table.

  3. #3
    Join Date
    Mar 2009
    Posts
    16
    Thanks, IdeasVacuum. I'll try to use the XML object, that seems interesting.

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    access the table like:
    Code:
    TextFiles.WriteFromTable("C:\\TestTable.txt", new_table[1], false);
    or use the JSON plugin to write the complete table to file

    http://www.indigorose.com/forums/sho...highlight=JSON
    Open your eyes to Narcissism, Don't let her destroy your life!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts