i am very new to this subject and i am trying to implement it in some parts of my code. this is something i have put together for a simple example.
--script
tables_util:iterate(gui_frame:GetChildren(), function(gui)
if gui:IsA("Textbutton") then
gui:Destroy()
end
end)
--module
function util:iterate<T>(tbl : {T}, func : (value : T) -> boolean)
local new = {}
for _, v in pairs(tbl) do
func(v)
end
return new
end
i studied through some sleitnick videos to start off. i just want to know if i am working with good practice. i’m a little bit confused because i don’t think firing a function per iteration is necessarily good for performance, but it could be. i am not sure though, which is why i am making this post.
if anybody could give me some helpful pointers, that would be great!