I’m using Fusion 0.3 to create UI in my game, I have three custom “components”
→ ButtonFX
→ ImageButton
→ TextButton
The image button and the text button needs to “inherit” ButtonFX’s functions in there property tables, but table.unpack() returns [number] = function (I’m pretty sure)
^ this is phrased weird, sorry
This is what I have for the “ImageButton” component (it’s 90% the same in the “TextButton” component, just with an added TextLabel)
return function(
scope: Fusion.Scope,
props: {
Name: UsedAs<string?>,
Layout: {
Position: UsedAs<UDim2?>,
Size: UsedAs<UDim2?>,
},
Image: UsedAs<string?>,
Enabled: UsedAs<boolean>?,
OnClick: (() -> ())
}
): Fusion.Child
return scope:New "ImageButton" {
Name = props.Name,
AnchorPoint = Vector2.new(0.5, 0.5),
Position = peek(props.Layout.Position),
ZIndex = 10,
Size = peek(props.Layout.Size),
Image = peek(props.Image),
BackgroundTransparency = 1,
-- this is the part that is broken
table.unpack(ButtonFX(scope, props)),
}
end
And heres what’s in ButtonFX
return function(scope: Fusion.Scope, props: {Enabled: UsedAs<boolean>?, OnClick: (() -> ())})
return {
[OnEvent "Activated"] = function()
-- code..
end,
-- Extra animations for mouses
[OnEvent "MouseEnter"] = function()
-- code..
end,
-- same goes with mouseleave, inputbegan, etc.
}
end
Is there an alternative to table.unpack() which basically adds a table to a table (i guess), or is there an entirely better way to do this?
If anyone needs more info I will be happy to provide it!