I have this:
Entries = TextFile.ReadToTable(OggsString);
EveryThreeLines = {};
for I = 1, Table.Count(Entries), 7 do
table.insert(EveryThreeLines, Entries[I]);
1 = Entries[1]
2 = Entries[2]
3 = Entries[3]
4 = Entries[4]
end
Sign up for email news and updates!
I have this:
Entries = TextFile.ReadToTable(OggsString);
EveryThreeLines = {};
for I = 1, Table.Count(Entries), 7 do
table.insert(EveryThreeLines, Entries[I]);
1 = Entries[1]
2 = Entries[2]
3 = Entries[3]
4 = Entries[4]
end
Last edited by ronwilliams; 07-29-2010 at 01:05 AM.
OMG, please put tags around your code people....
Now, what exactly are you trying to do? Is that a seven step for a table called EveryThreeLines? I'm entirely confused.
Action Plugins
AllOn | Box | Class | Cursor | DXML | Error | Frames | GlobalPaths | Goto | Group | INIPlus | KeyLock | MathEx | Menu | Project | Resize | StatusBar
Download
Sorry, I would like to read a text file to a table and then read and remove the the lines from that table starting at the bottom, not the top.
Hope that makes more sense.
Ron
Last edited by ronwilliams; 07-29-2010 at 01:43 AM.
Ok,
So if I had a table like this (assuming it has already been read from the text file)
I would do something like this...PHP Code:local tTable = {};
tTable[1] = "First Entry";
tTable[2] = "Second Entry";
tTable[3] = "Third Entry";
tTable[4] = "Fourth Entry";
tTable[5] = "Fifth Entry";
This is air code...make sure ya test it. Hope that helps.PHP Code:local tNewTable = {};
if tTable then
local nTotal = Table.Count(tTable);
for x = 1, nTotal do
-- I left 'nIndex' here as a local so you can see
-- what is going on and in case you want to create sub tables.
local nIndex = (nTotal - x) + 1;
tNewTable[x] = tTable[nIndex];
end
end
Action Plugins
AllOn | Box | Class | Cursor | DXML | Error | Frames | GlobalPaths | Goto | Group | INIPlus | KeyLock | MathEx | Menu | Project | Resize | StatusBar
Download
Tested here, seems to work.Code:local tTable = {"First Entry", "Second Entry", "Third Entry", "Fourth Entry", "Fifth Entry"}; local tReversed = {}; for K = #tTable, 1, -1 do table.insert(tReversed, tTable[K]); end
Thanks guys! It works. Sorry for the confusion! Will try and structure my questions better in the future.
Ron
Wow! That is too cool. You always have some neat little lua trick up your sleeve dontcha, Sakuya?
Action Plugins
AllOn | Box | Class | Cursor | DXML | Error | Frames | GlobalPaths | Goto | Group | INIPlus | KeyLock | MathEx | Menu | Project | Resize | StatusBar
Download
So it is. I mustv'e read that section a hundred times, but long ago before I knew anything about proper coding. Although I use the help file often for specific functions, it appears I need a refreshing overview of some of the highlight sections again.
Action Plugins
AllOn | Box | Class | Cursor | DXML | Error | Frames | GlobalPaths | Goto | Group | INIPlus | KeyLock | MathEx | Menu | Project | Resize | StatusBar
Download