View Single Post
04-25-14, 11:39 AM   #38
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
As stated above, k and v are just regular old variables. You could use anything else in their place. This is what has been done with your example. Instead of doing
Lua Code:
  1. for k, v in pairs(self.pluginConstructors) do
They did
Lua Code:
  1. for name, constructor in pairs(self.pluginConstructors) do
Since constructor turns out to be a function that they can call later in that statement,
Lua Code:
  1. local plugin = constructor()
I assume that the table self.pluginConstructors is structured like this:
Lua Code:
  1. self.pluginConstructors = {
  2.      pluginName1 = constructorFunction1,
  3.      pluginName2 = constructorFunction2,
  4.      pluginName3 = constructorFunction3,
  5. }
__________________
"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