widget disabling does not work (xpost from zk forum)

widget disabling does not work (xpost from zk forum)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

widget disabling does not work (xpost from zk forum)

Post by knorke »

Anyone got an idea why my widget posted in
http://zero-k.info/Forum/Thread/3257
does not disable itself?

Code: Select all

        if (not Spring.IsReplay()) then
                Spring.Echo ("replaycontrol: Not a replay, removing myself.")
                widgetHandler:RemoveWidget()
                Spring.Echo ("replaycontrol: LOL did not work")
        end
in infolog:
[f=0000000] replaycontrol: Not a replay, removing myself.
[f=0000000] replaycontrol: LOL did not work

Also is chili used ok like this or doing it wrong?
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: widget disabling does not work (xpost from zk forum)

Post by zwzsg »

widgetHandler:RemoveWidget() <- This is not instant. Your widget will not be called next time, but the function still finishes.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: widget disabling does not work (xpost from zk forum)

Post by knorke »

[22:08:01] <zwzsg[IRC]> I would add a "return" in your if (not Spring.IsReplay()) then
that worked.
Post Reply

Return to “Lua Scripts”