View Single Post
02-06-12, 08:13 AM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You should really use the local keyword when defining variables. Otherwise you're putting crap into the global namespace with generic names like "name" and "class".

Bad:
Code:
name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
Good:
Code:
local name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
This limits those variables to the scope in which they are defined, which is the only place they are needed. It also causes them to be garbage-collected after they go out of scope, instead of lying around forever.
  Reply With Quote