Thread Tools Display Modes
06-17-06, 10:47 AM   #1
kandoko
A Murloc Raider
Join Date: Jun 2006
Posts: 4
Question I am helpless with tables

Im only slightly familiar with coding and tables still blow my mind So any ideas or help is appreciated. The idea is to take an index value inside this table compress it and combine 3 seperate values into one index string. So index values 1,2,3 become index [1] ----3,4,5 become index [2] and so on..


Ok I have a set of data in a table collected from the Gatherer mod database formated as such
[1] = "gatherY 14.69 gatherX 5.6 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",
[2] = "gatherY 44.22 gatherX 50.67 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",
[3] = "gatherY 76.64 gatherX 51.92 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",
[4] = "gatherY 73.25 gatherX 52.07 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",
[5] = "gatherY 70.51 gatherX 52.16 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",
[6] = "gatherY 53.37 gatherX 54.3 gatherType Ore gather tin<20>vein gatherIcon 2 gatherC 1 locale enUS gatherZ 1 gatherEventType 1 dump 1",

Now I need to change this table in 2 ways then save as a new table.
change 1 involves shorting the name and adding "s" to all var in index 2 "t" to all in 3
then the pattern repetes. Also removed 2 var from indexs 2-3 (this dosnt need to happen but helps).

[1] = "gY 14.69 gX 5.6 gT Ore g tin<20>vein gI 2 gC 1 loc enUS gZ 1 gET 1 dump 1",
[2] = "gsY 44.22 gsX 50.67 gsT Ore gs tin<20>vein gsI 2 gsC 1 gsZ 1 gsET 1 ",
[3] = "gtY 76.64 gtX 51.92 gtT Ore gt tin<20>vein gtI 2 gtC 1 gtZ 1 gtET 1 ",

[4] = "gY 73.25 gX 52.07 gT Ore gather tin<20>vein gI 2 gC 1 loc enUS gZ 1 gET 1 dump 1",
[5] = "gsY 70.51 gsX 52.16 gsT Ore gs tin<20>vein gsI 2 gsC 1 gsZ 1 gsET 1 ",
[6] = "gtY 53.37 gtX 54.3 gtT Ore gt tin<20>vein gtI 2 gtC 1 gtZ 1 gtET 1 ",


Now that I have the table shortened i need to combine indexs 1,2,3 into one line, indexs 4,5,6 into one line etc....
So that it finally looks like this.
[1] = "gY 14.69 gX 5.6 gT Ore g tin<20>vein gI 2 gC 1 loc enUS gZ 1 gET 1 dump 1 gsY 44.22 gsX 50.67 gsT Ore gs tin<20>vein gsI 2 gsC 1 gsZ 1 gsET 1 gtY 76.64 gtX 51.92 gtT Ore gt tin<20>vein gtI 2 gtC 1 gtZ 1 gtET 1",

[2] = "gY 73.25 gX 52.07 gT Ore gather tin<20>vein gI 2 gC 1 loc enUS gZ 1 gET 1 dump 1 gsY 70.51 gsX 52.16 gsT Ore gs tin<20>vein gsI 2 gsC 1 gsZ 1 gsET 1 gtY 53.37 gtX 54.3 gtT Ore gt tin<20>vein gtI 2 gtC 1 gtZ 1 gtET 1"

Any ideas cause I am utterly clueless on how to implement it.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » I am helpless with tables


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off