On Wed, Apr 23, 2025 at 04:40:43PM +0200, William Lallemand wrote: > On Wed, Apr 23, 2025 at 04:31:41PM +0200, Willy Tarreau wrote: > > Subject: Re: some contribution for examples/lua > > Hi Baptiste, > > > > On Wed, Apr 23, 2025 at 01:44:09PM +0200, Baptiste wrote: > > > Hi, > > > > > > I'd like to make some contributions to examples/lua: > > > 1. update notice message in games.cfg to report trisdemo game name > > > 2. quick fix for trisdemo to avoid "blinking" effect > > > 3. an "invaders" game where we have to shoot aliens falling from the sky > > > 4. a "pong" game, which requires 2 players > > > > Thanks. A few nits: > > - could you please update the subject lines according to the > > contributing guide ? (i.e. prepend "EXAMPLES: games:" in front > > of them) > > > > - for the pong-like game, I think it would be useful to mention in > > the commit message that the real purpose is to see how to make > > two connections interact with a single context and put a few words > > about how this is achieved (since that's clearly the goal). Glancing > > over the code quickly doesn't reveal me the trick used to share the > > game's context. > > > > - a small detail for pong, it seems a bit too high for a default terminal > > (24 lines), the second player makes some stuff scroll on the screen. > > Also it would be useful to explain in it how to quit while waiting for > > the second player because socat in raw mode forwards everything to > > haproxy and I had to kill haproxy to stop it. > > > > - I'm seeing a FIXME in the code that seems to have been addressed since > > I'm not getting the described problem. Based on your description I guess > > the problem you faced is that you did not reset the text attributes > > before emitting a new line, but I could be wrong of course (and let's > > not go out of topic :-)) > > > > One thing that could be nice would be to use Aurélien's Queue API updates > > to illustrate how to use it to pass info between multiple contexts, but > > he already had some patches for trisdemo regarding this, they were just > > maybe a bit overengineered in that they made the code bigger instead of > > expectedly smaller. But maybe that would be more suited for another of > > these toys, I don't know. In any case that's something that can be > > improved later. > > > > Hello, > > Since we have more and more "big" lua scripts and examples I think we should > put the license in SPDX format in the > header of those.
Good point. > So maybe put something like this at the top of the lua file: > > -- SPDX-License-Identifier: GPL-2.0-or-later Given that they were done with help from code generators and they have very low value beyond educational one, I'd rather use more permissive ones like MIT, WTFPL or anything else so that anyone can happily port them to their projects. But yes, let's try to get used to placing this. Willy