Hello, I have a question on frame iteration and LUA scope (I am quite new to LUA). What I want to do is make a function that creates a bunch of child frames that connect to the parent frame and shoves them in a table but I haven't been able to make my attempts work. The reason I'd like to have a table is so that I can then iterate over them easily and change attributes.
Code below:
Code:
local frame = createframe('frame', 'frame', UIPARENT)
local frameCache = {}
local function = frameInit(name, x)
--make movable, allow mouse interaction, call makeMiniFrame x number of times
--relevent portion
for i = 1, x, 1 do
makeMiniFrame("frame" .. i, frame)
table.insert(frameCache, "frame" .. i)
end
end
local makeMiniFrame, otherFrameFunction
do
makeMiniFrame = function(name, parent)
local f = CreateFrame('Frame', name, parent)
otherFrameFunction()
return f
end
otherFrameFunction = function(name)
if name then
f = name
end
f: --dostuff to frame
return f
end
--REGISTER EVENTS
Is this the correct way of approaching this or am I completely off base?