[quote=nightcracker;176460]Hmm, collisions won't happen, because that's how metatable.__index works, but I respect your opinion, so my question is, how SHOULD I implement it? Like this?/QUOTE]
Collisions _will_ happen because of how metatables works.
If I use :Fire() on my frames to execute a temporary queue, and use the function to indicate that there's a need for that queue to be run:
if(object.Fire) then -- will evaluate to true.
if(rawget(object, 'Fire')) -- won't evaluate to true.
And no-one in their sane mind would use rawget to check for that without _knowing_ that the metatable under it could possibly have that variable name.
Originally Posted by nightcracker
Code:
local lib = LibStub:GetLibrary("LibCoreAPI")
local f = lib:CreateFrame("Frame")
But I hate that I can't use methods like estroy on the Micromenu, for example without having to set them. That's my laziness :P
|
Take a look at your code.
local functionName = function(self, ...)
end
when you insert you variables into the frame table (not the metatable) and do: frame:functionName() this translates to frame.functionName(frame), which is equal to lib.functionName(frame) (if the functions are exposed).
This means that it would be possible to use it like a ordinary utility set by doing:
lib.functionName(MicroMenuFrame) (or whatever it's named).
This is of course expecting those functions to be exposed in the lib.