lua: use the new trigger API in swim triggers
New swim:on_member_event triggers use a slightly changed new trigger API because it uses closures as triggers and a context can be passed. Firstly, swim:on_member_event returns closure over the new trigger instead of passed handler. Secondly, ctx can be passed as the second argument - it is considered as an old trigger if the object is callable and as ctx otherwise. Also, ctx can be passed as the third argument - it is considered as name if it is string and as ctx otherwise. And, ctx can be passed as the fourth argument. When one uses key-value API, ctx can be passed with key "ctx". Closes #6484 Closes #8659 NO_DOC=later
Showing
- changelogs/unreleased/gh-6484-any-callable-triggers.md 3 additions, 0 deletionschangelogs/unreleased/gh-6484-any-callable-triggers.md
- changelogs/unreleased/gh-8659-named-triggers copy.md 3 additions, 0 deletionschangelogs/unreleased/gh-8659-named-triggers copy.md
- src/lua/swim.c 53 additions, 1 deletionsrc/lua/swim.c
- src/lua/swim.lua 14 additions, 8 deletionssrc/lua/swim.lua
- test/box-luatest/triggers_old_api_test.lua 74 additions, 0 deletionstest/box-luatest/triggers_old_api_test.lua
Please register or sign in to comment