Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160

    Using a for loop to create multiple tables

    I am trying to create a for loop to create multiple tables with an incremental index name. I am not thinking straight tonight so the solution eludes me.

    for x = 1,10 do
    mytable..x = {}
    end

    That is one of the things I tried but AMS gave me a hard time about the syntax.
    Syntax Error: [Location="Intro:Button3", Event "On Click", Line=2]
    Error Detail: [`=' expected near `..'] in [mytable .. x = {}]


    Any suggestions?
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  2. #2
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    did you try

    for x = 1,10 do
    mytable[x] = {}
    end


    Stefan

  3. #3
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    Thanks Stefan,

    I was tired and a little under the weather and could not articulate my question very well. I am able to create one table in the fashion you provided, but what I was trying to do was create dynamically 10 different tables like such

    mytable1
    mytable2
    mytable3
    mytable4
    mytable5
    mytable6
    mytable7
    mytable8
    mytable9
    mytable10

    I am parsing out a text file that has multiple entries and I was hoping to create multiple tables from one file that were numbered incrementally. Will continue to plug away when I have time today.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Just a thought, but you could create one table with each row of the table being another table.

    Quote Originally Posted by TJ_Tigger
    Thanks Stefan,

    I was tired and a little under the weather and could not articulate my question very well. I am able to create one table in the fashion you provided, but what I was trying to do was create dynamically 10 different tables like such

    mytable1
    mytable2
    mytable3
    mytable4
    mytable5
    mytable6
    mytable7
    mytable8
    mytable9
    mytable10

    I am parsing out a text file that has multiple entries and I was hoping to create multiple tables from one file that were numbered incrementally. Will continue to plug away when I have time today.

    Tigg

  5. #5
    Join Date
    Nov 2003
    Location
    Salzburg / Austria
    Posts
    312
    Extreme programming:

    generat a table.lua file

    for x = 1,10 do
    text="mytable"..x.." = {}"
    TextFile.WriteFromString(...text...)
    end


    load the table.lua file with
    dofile(table.lua)


    Stefan

Similar Threads

  1. Replies: 3
    Last Post: 07-17-2003, 08:30 AM
  2. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM
  3. HOWTO: Create a Page Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-26-2002, 05:20 AM
  4. HOWTO: Create an Empty Folder
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-21-2002, 03:21 PM
  5. HOWTO: Create Nested Shortcuts in the Start Menu
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 09-24-2002, 10:26 AM

Posting Permissions

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