You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been looking at this problem for a couple of days, and I'm really starting to doubt my sanity.
The following snippet is a simplified example that uses some questionable logic that makes more sense in the full context.
I have a button, an icon and a text item. The button toggles the icon and text to be drawn and triggers a function.
The toggling of the visibility works, but the function is only triggered when drawing = false.
localenabled=truelocalreset_itemlocalfunctioninit_bar()
localmenu_icon=sbar.add("item", "menu.icon", {
icon= {
string="M",
},
})
localitem_icon=sbar.add("item", "menu.item.icon", {
icon= {
string="I",
},
})
sbar.add("item", "menu.item.text", {
label="TEXT",
})
item_icon:subscribe({ "reset_items" }, reset_item)
menu_icon:subscribe("mouse.clicked", function()
enabled=notenabled-- inverse the booleansbar.set("/menu\\.item\\..*/", { drawing=enabled }) -- toggle the menu visibilityprint("drawing = " ..tostring(enabled)) -- debug statement showing the value of "enabled"sbar.trigger("reset_items") -- trigger the reset_items function (DOES NOT RUN WHEN enabled = true)end)
endreset_item=function()
print("TEST")
endinit_bar()
The output when I press the button, setting drawing = false:
drawing = false
TEST
The output when I press the button, setting drawing = true:
drawing = true
I'm expecting the output to show TEST when drawing is set back to true.
The text was updated successfully, but these errors were encountered:
I've been looking at this problem for a couple of days, and I'm really starting to doubt my sanity.
The following snippet is a simplified example that uses some questionable logic that makes more sense in the full context.
I have a button, an icon and a text item. The button toggles the icon and text to be drawn and triggers a function.
The toggling of the visibility works, but the function is only triggered when
drawing = false
.The output when I press the button, setting
drawing = false
:The output when I press the button, setting
drawing = true
:I'm expecting the output to show
TEST
whendrawing
is set back totrue
.The text was updated successfully, but these errors were encountered: