View Single Post
02-19-12, 05:19 AM   #13
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
#1: Lua allows use of both commas and semicolons as a field delimiter in table construction. I prefer semicolons when I have a single entry per line.

#2: I'm used to programming languages requiring lines ending with a semicolon. I know Lua doesn't, but it's my programming style to have them in anyway. It doesn't impact processing in any way and I see no need to remove them. As far as making code difficult to read, I don't believe that at all.

#3: I'll have to test this myself, but I was sure I had some player-specific data loading at addon load.
Edit: Tested and was found not to be one of the functions.

#4: It's unconventional and may not be the best way to do it, but the 12th arg is assigned to guid and the first and second are assigned to the other two. Note select() has values listed after it (another vararg), so the extra values from select() are dropped. I've used this before, I know it works and the process that makes it work.

#5: I see no difference in between the performance of these two methods. Again, it's up to programming style. You're running the same number of conditionals, the same checks, even the same relative structure. You move the end keyword up to the top, flip the condition, and add a return keyword for it to run. And the load time changes how?



Update: The GUID detection has been fixed in the code above. Another bug was missing a couple instances of the renamed upvalue.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 02-19-12 at 06:09 AM.
  Reply With Quote