Thread Tools Display Modes
09-18-08, 12:38 PM   #1
saffire
A Murloc Raider
Join Date: Sep 2007
Posts: 4
Looking for the a point in the right direction...

Very green to LUA but I am an experienced C# programmer.

I have a webapp that generates this LUA file. Which is just a big lua table with nested tables.

(If this isnt correct syntax for the table and your willing to take the time to point out whats wrong any help is appreciated)

http://www.croatoanstudios.com/lua/WowStorianDB.txt

I want to build an addon so that I can do two things......

Destination could be declared as local or officer, if it is local it just displays it locally in your chat window, if it’s officer it displays it to officer chat.

Code:
/wowstorian datareport <destination>
It would spit out the following information regarding the currently loaded data:

Code:
Line1:    Wowstorian Report Generated (<ReportGenerated>)
Line2:    Reporting on <EventTypeReportedOn>
Line3:    For Date Range: <StartDate> through <EndDate>
Code:
/wowstorian playerreport <playername> <destination>
It would print the following lines to the specified destination.

Code:
Line1:   Player Name: Saffire
Line2:    Attendance :  90%
Line3:    No Shows :  5%
Line4:    Signups: 100%
Line5:    Item’s Received: 15
Line6:  Last 5 Items Received: <Item Link> (Date), <Item Link> (Date), <Item Link> (Date), <Item Link> (Date), <Item Link> (Date)

I havent been able to find any examples or tutorials that were simply but on topic enough to help me design this myself. So I am looking for a pointer in the right direction about how to do this or someone who's willing to work with me and help me build what I want.
  Reply With Quote
09-18-08, 02:43 PM   #2
Sekrin
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
Hmm, this looks interesting. I've had a look at your database file, and you'll have to do the following:
  • Get rid of those % signs, or you'll have to turn them into strings, otherwise WoW gets all confused.
  • All of the item names need to be enclosed in double-quotes.
  • The dates won't be imported properly, as 8/28/2008 will be interpreted as (8 divided by 28) divided by 2008 - which is a very small number. Unless you need to do some sort of manipulation on the dates, I'd recommend converting them to strings. If you do, you'll probably need to convert them to numbers - as far as I'm aware, LUA does not have a "date" data type... even the date() API returns either a string or a table...

I'll have a look at implementing the other bits over the course of this evening.
__________________
  Reply With Quote
09-18-08, 03:49 PM   #3
saffire
A Murloc Raider
Join Date: Sep 2007
Posts: 4
Thanks for the response....

I was messing around some more in LuaEdit and realized a few problems with the table and made some adjustments to the following. From reading your response I believe it corrects the majority of the concerns you had except one, the dates with LUA interpretting the / as a division sign. Could a . be used instead?

For example:

Code:
["Key"] = "08.28.2008";

I am not 100% clear on why the / gets translated being that it is encapsolated in quotes I thought the quotes would designate the value as a string and not literals.

Code:
WowStorianDB = {
    ["Players"] = {
        
        ["Cooder"] = {
            ["PlayerName"] = "Cooder",
            ["PlayerID"] = 263,
            ["Attendance"] = {
                ["Count"] = 2,
                ["Potential"] = 2,
                ["Percentage"] = "100%",
            },
            ["NoShows"] = {
                ["Count"] = 0,
                ["Potential"] = 2,
                ["Percentage"] = "0%",
            },
            ["Signups"] = {
                ["Count"] = 2,
                ["Potential"] = 2,
                ["Percentage"] = "100%",
            },
            ["LootDetails"] = {
                ["ItemCount"] = 7,
                ["LastFiveItems"] = {
                    [1] = {
                        ["ItemName"] = "Shadowsong Amethyst",
                        ["ItemID"] = 32230,
                        ["Recieved"] = "8/28/2008",
                    },
                    [2] = {
                        ["ItemName"] = "Seaspray Emerald",
                        ["ItemID"] = 32249,
                        ["Recieved"] = "8/28/2008",
                    },
                    [3] = {
                        ["ItemName"] = "Lionseye",
                        ["ItemID"] = 32229,
                        ["Recieved"] = "8/28/2008",
                    },
                    [4] = {
                        ["ItemName"] = "Crimson Spinel",
                        ["ItemID"] = 32227,
                        ["Recieved"] = "8/28/2008",
                    },
                    [5] = {
                        ["ItemName"] = "Empyrean Sapphire",
                        ["ItemID"] = 32228,
                        ["Recieved"] = "8/28/2008",
                    },
                },
            },
        },
        ["Vampira"] = {
            ["PlayerName"] = "Vampira",
            ["PlayerID"] = 283,
            ["Attendance"] = {
                ["Count"] = 2,
                ["Potential"] = 2,
                ["Percentage"] = "100%",
            },
            ["NoShows"] = {
                ["Count"] = 0,
                ["Potential"] = 0,
                ["Percentage"] = "0%",
            },
            ["Signups"] = {
                ["Count"] = 0,
                ["Potential"] = 2,
                ["Percentage"] = "0%",
            },
            ["LootDetails"] = {
                ["ItemCount"] = 1,
                ["LastFiveItems"] = {
                    [1] = {
                        ["ItemName"] = "Pauldrons of the Forgotten Conqueror",
                        ["ItemID"] = 31101,
                        ["Recieved"] = "8/28/2008",
                    },
                },
            },
        },

    ["ReportGenerated"] = "9/18/2008",
    ["ReportSpecifics"] = {
        ["StartDate"] = "8/18/2008",
        ["EndDate"] = "9/18/2008",
        ["EventTypeReportedOn"] = "Official25ManRaid",
    },
}
  Reply With Quote
09-18-08, 04:41 PM   #4
Sekrin
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
The file you linked did not have the quotes around the dates, which is why the "/" signs were being read as division.
Code:
                    [1] = {
                        ["ItemName"] = Softstep Boots of Tracking,
                        ["ItemID"] = 32510,
                        ["Recieved"] = 8/26/2008,
Anyway, I've made the necessary changes to the database file as per my original post and proceeded from there. The only difference between your file and mine is that I've just removed all the "%" signs from the file (so the percentages are now just numbers, whereas you've marked them as strings). The addon itself is now finished, and I'm in the process of adding it to WoWI. If you look under my addons in an hour or two it should appear (subject to approval by the WoWI admins, of course).
__________________
  Reply With Quote
09-18-08, 04:49 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Did I miss the part where saffire gave permission for you to upload it, Sekrin?

Also, % signs are fine in strings, otherwise you would not see any % signs in the game.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
09-18-08, 05:13 PM   #6
saffire
A Murloc Raider
Join Date: Sep 2007
Posts: 4
I grant my permission.

I appreciate all the help on this!
  Reply With Quote
09-18-08, 05:14 PM   #7
Sekrin
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
Originally Posted by Seerah View Post
Did I miss the part where saffire gave permission for you to upload it, Sekrin?
Erm, why should I ask Saffire's permission to upload my addon? It was made at their request, but it's my work...

Originally Posted by Seerah View Post
Also, % signs are fine in strings, otherwise you would not see any % signs in the game.
I never said that that they were not fine. Saffire's original file had entries such as the following:
Code:
["Percentage"] = 0%,
I just removed the % sign so that WoW would load it, whereas Saffire's (equally valid) solution was to turn it into a string.
__________________
  Reply With Quote
09-18-08, 06:18 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Sekrin View Post
Erm, why should I ask Saffire's permission to upload my addon? It was made at their request, but it's my work...
Ah, then I was misunderstanding the database to be code. My apologies.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Looking for the a point in the right direction...


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