View Single Post
04-25-14, 11:16 AM   #37
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Ok now im starting to see it, as you stated "k" is normal short for "key" and "v" is short for "value" just like I see "f" for "frame".

Now is this normally the standard or do different people use different letters, also would it be beneficial to use different letters not to accidently interact with other peoples functions?

In this example:
Lua Code:
  1. self.plugins = {}
  2. for name, constructor in pairs(self.pluginConstructors) do
  3.     local position = db.datapanel[name]
  4.     if position and position > 0 then
  5.         local plugin = constructor()
  6.         self.plugins[name] = plugin
  7.         self:PlacePlugin(position, plugin)
  8.     end
  9. end

name = the name of the plugin.
constructor = ?? Where did the constructor() function come from?

And why is it I see a lot of people do somename = {} I understand the the {} is the start and finish of a table but wouldn't if just be a blank table.

Also does the [] around a "name" make it so that it could be any "name" in that table, so instead fo using db.datapanel.dps and db.datapanel.hps, db.datapanel[name] would be able to find both of those name in a shorter text.

It was stated before that this is a file not a macro so we should not shorten names because there is no need to save space. If that is the case why do I see a lot of other using short cuts and abbreviated name?

Thanks for answering these questions and helping me and maybe others trying to learn this wonderful thing called lua.

Coke
  Reply With Quote