View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
---|---|---|---|---|---|---|---|---|---|
0004404 | Spring engine | Lua | public | 2014-05-31 16:52 | 2014-06-02 20:32 | ||||
Reporter | msafwan | ||||||||
Assigned To | abma | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Product Version | 96.0.1+git | ||||||||
Target Version | 98.0 | Fixed in Version | |||||||
Summary | 0004404: Gadget's ChatAction() always call a function twice | ||||||||
Description | I mean, if I do: /luarules testabc (using the following gadget) then the function "TestFunction" is always called twice. This never happen in Spring 91. *This might hint some underlying bug and also cause problem in creating a toggle action. | ||||||||
Tags | chat action | ||||||||
Checked infolog.txt for Errors | |||||||||
Attached Files |
|
![]() |
|
msafwan (reporter) 2014-05-31 16:55 |
Please try the gadget, its mod independent and is really simple. Just do "/luarules testabc" and watch echo |
silentwings (reporter) 2014-05-31 19:21 Last edited: 2014-05-31 19:24 |
Reproduced this. I tried it with BA and 96.0 and the TestFunction was only called once after sending "/luarules testabc". However, with BA and 96.0.1-443, the TestFunction was called twice. Imo this should be fixed before a release. |
jK (developer) 2014-06-01 13:00 |
It's not called twice ... There are 2 callins for handling chat messages GotChatMsg & ConfigureLayout, the latter is deprecated. The failure is on your side, chat actions are _control_ events, means when a receiver returns true _any_ further processing is stopped. You instead return nothing := false, and so tell the engine & addon handler that you didn't processed the chat action, and that it should test further if other receivers may be interested in it. And when no one was, it will try the other chat msg event. |
silentwings (reporter) 2014-06-01 14:00 Last edited: 2014-06-01 20:50 |
Well - I simply inherited code (written by others) that used to work & was broken by a change within the engine. I think you should mark the relevant part of the changelog as a breaking change. I didn't find any documentation to say that the return argument of chat actions actually did something. Edit: I tried adding return true to the example gadget above, with the BA svn, and the test function was still called twice. I added some debug info to the gadgethandler, and it seems that gadgetHandler:GotChatMsg is actually called twice (it returns false the first time it is called). |
jK (developer) 2014-06-02 00:58 |
> Edit: I tried adding return true to the example gadget above, with the BA svn, and the test function was still called twice. I added some debug info to the gadgethandler, and it seems that gadgetHandler:GotChatMsg is actually called twice (it returns false the first time it is called). Synced & Unsynced? |
jK (developer) 2014-06-02 01:00 |
bluestone_irc: [LCC]jK, i guess the problem with GotChatMsg being called twice is that unsycned now also recieves GotChatMsg and the gadgethandler is not prepared for this (it calls SendToUnsynced) k that's might be |
abma (administrator) 2014-06-02 10:41 Last edited: 2014-06-02 11:07 |
just remove this? https://github.com/spring/spring/blob/develop/cont/base/springcontent/LuaGadgets/gadgets.lua#L890 if (IsSyncedCode()) then SendToUnsynced(player, msg) end |
silentwings (reporter) 2014-06-02 20:27 |
yep, that's the fix |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2014-05-31 16:52 | msafwan | New Issue | |
2014-05-31 16:52 | msafwan | File Added: dbg_gadgetAction.lua | |
2014-05-31 16:53 | msafwan | Tag Attached: chat action | |
2014-05-31 16:55 | msafwan | Note Added: 0013173 | |
2014-05-31 19:21 | silentwings | Note Added: 0013174 | |
2014-05-31 19:22 | silentwings | Note Edited: 0013174 | View Revisions |
2014-05-31 19:23 | silentwings | Note Edited: 0013174 | View Revisions |
2014-05-31 19:24 | silentwings | Note Edited: 0013174 | View Revisions |
2014-06-01 00:59 | abma | Target Version | => 98.0 |
2014-06-01 13:00 | jK | Note Added: 0013176 | |
2014-06-01 14:00 | silentwings | Note Added: 0013178 | |
2014-06-01 19:33 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-01 19:33 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-01 19:34 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-01 19:41 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-01 20:46 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-01 20:50 | silentwings | Note Edited: 0013178 | View Revisions |
2014-06-02 00:58 | jK | Note Added: 0013183 | |
2014-06-02 01:00 | jK | Note Added: 0013184 | |
2014-06-02 10:41 | abma | Note Added: 0013185 | |
2014-06-02 10:42 | abma | Note Edited: 0013185 | View Revisions |
2014-06-02 11:07 | abma | Note Edited: 0013185 | View Revisions |
2014-06-02 20:27 | silentwings | Note Added: 0013186 | |
2014-06-02 20:32 | abma | Changeset attached | => spring release 70b3a9f7 |
2014-06-02 20:32 | abma | Assigned To | => abma |
2014-06-02 20:32 | abma | Status | new => resolved |
2014-06-02 20:32 | abma | Resolution | open => fixed |