Thread Tools Display Modes
Prev Previous Post   Next Post Next
07-11-10, 05:32 PM   #1
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Tables

Consider:

day = the day
ate = number of times i ate in day
food = ate food
candy = ate candy
drank = number of times i drank in day
peed = number of times i peed in day
gallonsPeed = number of gallons i peed that time
poopt = number of times i poopt in a day
regnum = regnum+1
all the values are being sent to the table as integers on a constant stream, creating a large table.

if i need to be able to keep track of this data and sort.. what is the best way to do it?

Register={
["day"]=day,
["ate"]=ate,
["fd"]=food,
["cd"]=candy,
["dr"]=drank,
["pd"]=peed,
["gl"]=gallonSpeed -- for this exercise we will assume i only pee in round gallons
["pt"]=poopt
["rn"]=regnum
}

--if i want to be able to call up and print the following:

--on the [candy] days that you ate candy, you pooped [poopt] times total and peed [peed] times resulting in [gallonsPeed] gallons peed total.


for regnum=1, regnum do

print("on the ", Register.cd, " days that you ate candy, you pooped ", Register.pt, " times total and peed", Register.pd, " times resulting in ", Register.gp, " gallons peed total.")

--obviously, this only prints the current register and not an accrued amount.

my table has 17 variables for each entry and i need to be able to call totals from some variables based on whether other variables are (>0) or (==0).

is this even the right/most efficient method of doing this?
if so, how do i add the values up for printing?

thanks for suffering my awful example.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » 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