FramePoolCollectionMixin :CreatePool()
(Redirected from API FramePoolCollectionMixin GetOrCreatePool)
Jump to navigation
Jump to search
- These functions are implemented in
.:CreatePool FrameXML/Pools.lua
- These functions are implemented in
Returns a frame pool within a collection of frame pools.
pool = collection:CreatePool(frameType, parent, template [, resetterFunc, forbidden]) pool = collection:GetOrCreatePool(frameType, parent, template [, resetterFunc, forbidden]) collection:CreatePoolIfNeeded(frameType, parent, template [, resetterFunc, forbidden])
Arguments
- frameType
- string - See CreateFrame().
- parent
- string|nil - Required, even if nil, because the third argument is required.
- template
- string - Identifies each pool within the collection.
- resetterFunc
- function? - See CreateFramePool().
- forbidden
- boolean? - See CreateFramePool().
Returns
- pool
- table - FramePoolMixin
Details
- Every pool in a collection is identified by its XML template, so unlike CreateFrame or CreateFramePool this argument is required.
- GetOrCreatePool() avoids overwriting an existing pool, which CreatePool() would do.
- CreatePoolIfNeeded() also creates the pool if it does not exist, but without any return value.
Example
local collection = CreateFramePoolCollection()
collection:CreatePool("Frame", nil, "BackdropTemplate")
local frame = collection:Acquire("BackdropTemplate")
Patch changes
- Patch 9.1.0 (2021-06-29): Added CreatePoolIfNeeded().[1]
- Patch 8.2.0 (2019-06-25): Added GetOrCreatePool().[2]
- Patch 8.1.5 (2019-03-12): Moved to PoolCollectionMixin.[3]
- Patch 7.3.0 (2017-08-29): Added as
PoolCollection:CreatePool()
.[4]
References
- ^ 2019-06-25, Pools.lua, version 9.1.0.38312, near line 220, archived at Townlong-Yak
- ^ 2019-06-25, Pools.lua, version 8.2.0.30920, near line 216, archived at Townlong-Yak
- ^ 2019-03-12, Pools.lua, version 8.1.5.29701, near line 232, archived at Townlong-Yak
- ^ 2017-08-28, Pools.lua, version 7.3.0.24920, near line 210, archived at Townlong-Yak