Closed WorldChallenge1 closed 7 months ago
Also when passing the object it does work
local basalt = require("basalt")
local main = basalt.createFrame()
local container = main:addFrame("container")
local button = container:addButton("removableButton")
:setPosition(2, 2)
:setText("Remove me")
main:addButton()
:setPosition(2, 4)
:setText("Remove the button above")
:onClick(function()
local removed = container:removeChild(button)
if removed then
basalt.debug("Button removed!")
else
basalt.debug("Button not found!")
end
end)
basalt.autoUpdate()
In a related note Flexbox seems to not work at all either way
local basalt = require("basalt")
local main = basalt.createFrame()
local container = main:addFlexbox("container")
local button = container:addButton("removableButton")
:setPosition(2, 2)
:setText("Remove me")
main:addButton()
:setPosition(2, 4)
:setText("Remove the button above")
:onClick(function()
local removed = container:removeChild("removableButton")
if removed then
basalt.debug("Button removed!")
else
basalt.debug("Button not found!")
end
end)
basalt.autoUpdate()
Using the object it doesn't crash but it is unable to find the child
local basalt = require("basalt")
local main = basalt.createFrame()
local container = main:addFlexbox("container")
local button = container:addButton("removableButton")
:setPosition(2, 2)
:setText("Remove me")
main:addButton()
:setPosition(2, 4)
:setText("Remove the button above")
:onClick(function()
local removed = container:removeChild(button)
if removed then
basalt.debug("Button removed!")
else
basalt.debug("Button not found!")
end
end)
basalt.autoUpdate()
Hey, i think it is fixed now. I didn't try the flexbox. Thank you for the report!
Downloaded the source and tried all the examples and they all worked without problems. Thanks!
Describe the bug
When trying to use the function removeChild with an ID of an element this gives an error
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The specified children of the container gets removed.
Probable cause
The problems seems to be that when passing a string it tries to call the method getName() which is a method of basalt Object's (2nd screenshot)
Screenshots
Checklist
[x] I am running the latest version.