At a glance:
(1) In lib.lua, you have a
global function named CreateBackdrop. Global bad. Local good. Fix.
(2) Also in lib.lua you have
local addonName = select(1, GetAddOnInfo('!Beautycase')) -- What is this, I don't even. You should absolutely never use
select to select the first argument. (I would argue that you should pretty much never use
select for anything except looping over varargs, but that's another story...)
(3) You don't need that
local _ on line 14, either. Not only did you already define a local underscore on line 1, but you should not be leaking variables anywhere to need this declaration at the file level anyway.
(4) You may want to make your frame checks a bit more robust.
if (not self:IsObjectType('Frame')) then will work in most cases, but if you start trying to skin things that are using metatables for prototyping, you may end up with errors when you try to
CreateTexture on
self. A better check would be:
if type(self) ~= "table" or type(rawget(self, 0)) ~= "userdata" then
Also, I don't really like the !Beautycase approach which injects a bunch of functions into the Frame object metatable. There's really no need for it, and it seems likely to conflict with other addons using the same unnecessary technique.
(5) In units.lua you have
self.Leader = Leadera -- remove the trailing "a" to get it working.
(6) Your party and raid frames are still not getting their
UnitSpecific functions called. See
my previous post about this for the solution.
(7) You have an entry in
UnitSpecific for "raid" in units.lua, and an entry for "party" in raid.lua. No point in having these entries when those units aren't handled in those files.