Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-05-17, 09:51 AM   #1
Mayron
A Frostmaul Preserver
 
Mayron's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 275
How to properly use CreateFramePool() ?

I've been seeing a lot of Blizzard code using CreateFramePool() and I'm wondering if it's worth using this myself as opposed to creating my own stack-like data structure. However, maybe it does something more than this but I can't find any documentation on it.

This is the content found inside a returned frame pool object:

ReleaseAll
achieveObjects
numActiveObjects
inactiveObjects
GetNumActive
resettingFunc
OnLoad
creationFunc
EnumerateActive
Release
Acquire
GetNextActive
EnumerateIntactive

My question is this: Is there any documentation on how to use this?

I'm assuming that you can disable/enable frames from the pool using:

Lua Code:
  1. local pool = CreateFramePool()
  2. local frame = pool:Acquire() -- uses an inactive frame or creates one with "creationFunc" function
  3. pool:Release(frame) -- not really sure if this is the correct way to disable the frame
  4.  
  5. -- something is always true. Maybe it represents if the frame is active, but since I am iterating over only active frames this seems pointless
  6. for frame, something in pool:EnumerateActive() do
  7.     -- run code to update your frame (could be a buff icon for example)
  8. end

Not sure what OnLoad does. Does it run when a frame becomes active?

Last edited by Mayron : 08-05-17 at 09:53 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » How to properly use CreateFramePool() ?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off