View Single Post
08-28-20, 07:24 PM   #12
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 233
Hi Zlodo

I don't have locals inside functions as each variable exists within its function.

It is each frame, button and function that are local; I have a few workarounds such as having frame and button names in a table, eg;
Lua Code:
  1. local framesNbuttons = {frameA, frameB, buttonA, buttonB}
  2.  
  3. framesNbuttons.frameA = CreateFrame("Frame")
  4.  
  5. framesNbuttons.buttonA = CreateFrame("Button")

I was just wondering if there is a better way to approach this issue.

Further, could I do the same thing with functions?
Lua Code:
  1. local functions = {functionA, functionB}
  2.  
  3. functions.functionsA = function runFunctionA ()

I have tried this with no success, yet I am not sure if this is a correct way of using functions in a table or not.
  Reply With Quote