I Lua’rned some more today.

//I Lua’rned some more today.

I Lua’rned some more today.

The second day of my Lua efforts have gotten me further along. It’s a slow but constant project that I think will fruit in the near future. The hardest part is integrating this thing with titan panel. The guides and templates that they provide for titan panel seem to either be wrong or unhelpful. That’s fine though, the guides appear to be for an outdated version. Though it would be nice if people updated their guides when they updated their software and functions.

I don’t have a whole lot to show today but that little script I showed yesterday I’ve compressed from dozens of lines into a very small loop and table.


local prof1, prof2, archaeology, fishing, cooking, firstAid = GetProfessions();
ProfTable = { prof1, prof2, archaeology, fishing, cooking, firstAid }

for i = 0, 6, 1 do
if ProfTable[i] ~= nil then
local name, _, skillLevel, maxSkillLevel, _, _, _, _ = GetProfessionInfo(ProfTable[i]);
print(“” .. name .. ” “.. skillLevel .. ” / ” .. maxSkillLevel);


If you know what you are doing this is probably not all that interesting but for me this was my “hello world” and it felt wonderful. Basically the first thing we do is change the 6 variables “prof1”, “prof2”, and so on to their equivalent values in World of Warcraft. Once we’ve done that we can then build a neat little table out of it with the second command. What that table does is basically say the following:


ProfTable[1] = prof1
ProfTable[2] = prof2
ProfTable[3] = archaeology
ProfTable[4] = fishing
ProfTable[5] = cooking
ProfTable[6] = firstAid

Then we use that table to create a neat little loop that will do all our “if then” statements in one quick go! The script says “Does the player even HAVE a profession in this slot?” which is the ~=nil question, if there is anything but nil in that variable spot then it will continue to do the rest of the script.

local name, _, skillLevel, maxSkillLevel, _, _, _, _ = GetProfessionInfo(ProfTable[i]);

This might look a little confusing but just consider _, to be values that exist but we don’t give two toots about right now. The only ones that concern us are name, skillLevel, and maxSkillLevel. I’d like to point out that World of Warcraft apparently doesn’t understand the importance of keeping things consistent. skillLevel what is up with that capital L? Then maxSkillLevel has a capital S AND L. It’s not even consistent with the variable right beside it. Good heavens guys…

Also the actual spell is “First Aid” in game so if you called the spell with “firstAid” it would fail. Anyways…

The loop fills in the data with the relevant info for that particular profession! That’s what “GetProfessionInfo(variable);” does! The nice thing about this is we can use this function in my future plans and have a single titan panel addon that can collect the data from any of the 6 professions that a player might have. The big hurdle for me is to learn about child buttons in titan panel which, sadly, is much more complicated than learning the little bit of Lua that I know so far.

I’m hoping that once I get beyond this hurdle I can go back to the wonderful world of slash commands. Those are so much simpler and less aggravating. Thanks for visiting! I might write a “for dummies” guide to Lua down the road at this rate. I feel like people could benefit from a Lua guide that isn’t written with a thesaurus the entire time. I feel like I’m deciphering German cryptography sometimes.

PS. Those .. up above are concatenating. I’ll explain that in the next update, since it’ll be seen more and more soon.

By | 2014-01-28T10:43:27+00:00 January 27th, 2014|Journal|2 Comments