View Single Post
09-19-12, 02:31 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,334
The above posts only answer for a solution, but don't explain why Lua is acting the way it does. If you want to use any upvalue (function or variable), they need to be defined as a local before the parser comes to the function and compiles it. If this is not done, the parser assumes the function is trying to reference a global variable instead and any upvalue defined afterward will not make it into its list.

Globals ignore this "define before use" rule because by default, variables encountered are seen as globals unless they have already been explicitly defined as a local in the current scope or any scope execution is nested in.
__________________
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 : 09-19-12 at 02:38 PM.
  Reply With Quote