View Single Post
02/05/16, 09:51 AM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,580
Getting back the "class" of a ZO_Object subclass instance

Oh great Lua guru, I summon thee, please heed my call!

I am in need of some great Lua magic.

I have two questions.
Is it possible to access local variables from a different file that are not exposed in any way? Probably not, but I figured I'd just ask anyway.
UNITFRAME_BAR_STYLES in unitframes.lua does not have any way to access it indirectly.

And is it possible to get the "class" of a ZO_Object subclass back from an instance and create new objects of that type?
Or more specifically UnitFrameBar.
I can for example access an instance of that class with the following code:

Lua Code:
  1. local group1 = ZO_UnitFrames_GetUnitFrame("group1")
  2. group1.healthBar -- this is a UnitFrameBar
  3. -- some magic needs to happen here to get UnitFrameBar
  4. local myUnitFrameBar = UnitFrameBar:New(...)
  Reply With Quote