View Single Post
08-05-13, 05:25 PM   #35
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Please use [code] tags around code blocks, not [quote] tags -- the latter does not preserve indentation, and makes the code annoyingly difficult to read.

Originally Posted by Akatosh View Post
PD: whats the diference betwen "{ or }" and "( or )"
{ curly brackets } create a table object:

Code:
-- Indexed table, array, or list:
local animals = { "cat", "dog", "pig" }

-- Dictionary table, or hash table:
local animals = {
   ["cat"] = "meow",
   ["dog"] = "woof",
   ["pig"] = "oink",
}
( parenthesis ) enclose conditions or function arguments:

Code:
-- This:
if thisVar == 5 or (thatVar == 2 and otherVar == "x") then
   -- do something
end

-- ... is a more compact way of writing this:
if thisVar == 5 then
   -- do something
elseif thatVar == 2 and otherVar == "x" then
   -- do the same thing
end
Code:
function DoSomething(thisVar, thatVar, otherVar)
   -- do something
end

DoSomething(5, 2, "x")
However, I really feel like a broken record here, but copying all these Broker plugins and shoehorning them into kgPanels is really pointless. The Broker plugin you posted won't take up any more memory than a kgPanels panel running the same code (in fact, it will probably take up less memory) and a Broker display addon is not any more heavyweight than kgPanels -- but on any machine capable of running WoW at all, worring about a few dozen or even a few hundred KB is just laughably irrelevant. You might as well worry that one of your T-shirts has 15 more molecules than another, and that those few extra molecules are going to somehow be the difference between you being able to walk around normally, and you being collapsed into a black hole. That memory really does not matter one bit.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 08-05-13 at 05:30 PM.
  Reply With Quote