Thread: Global vars ?
View Single Post
11-03-14, 06:25 AM   #20
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by AlleyKat View Post
in your way I must
Code:
local title = ...;
local M = _G[title];
So... adding one line of code is worse, in your mind, than adding multiple extra lines of code and adding the overhead of multiple metatables in your original example?

Originally Posted by AlleyKat View Post
Standard metatable functions
in frame case we redirect all get and set notfound operations to build-in
in build-in we adding frame api
and now we don't care what table to use, coz they are same
This is just bad programming. If you want to be able to use two variables to refer to the "same" object, just create one object and point two variables to it. Creating two objects and using metatables to make them act like the same object is just ... I don't even know where you came up with such a convoluted idea. There's no benefit to doing this whatsoever. Then again, there's no benefit to having two variables in the same scope that refer to the "same" object, either, other than purposefully making your code more complicated and difficult to read.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote