1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-10 19:21:37 +00:00
haproxy/examples/lua
Willy Tarreau ed1d4807da EXAMPLES: add "games.cfg" and an example game in Lua
The purpose is mainly to exhibit certain limitations that come with such
less common programming models, to show users how to program interactive
tools in Lua, and how to connect interactively.

Other use cases that could be envisioned are "top" and various monitoring
utilities, with sliding graphs etc. Lua is particularly attractive for
this usage, easy to program, well known from most AI tools (including its
integration into haproxy), making such programs very quick to obtain in
their basic form, and to improve later.

A very limited example game is provided, following the principle of a
very popular one, where the player must compose lines from falling
pieces. It quickly revealed the need to the ability to enforce a timeout
to applet:receive(). Other identified limitations include the difficulty
from the Lua side to monitor multiple events at once, but it seems that
callbacks and/or event dispatchers would be useful here.

At the moment the CLI is not workable (it interactivity was broken in 2.9
when line buffering was adopted), though it was verified that it works
with older releases.

The command needed to connect to the game is displayed as a notice message
during boot.
2025-04-01 09:10:00 +02:00
..
event_handler.lua
mailers.lua CLEANUP: assorted typo fixes in the code and comments 2023-11-23 16:23:14 +01:00
README
trisdemo.lua EXAMPLES: add "games.cfg" and an example game in Lua 2025-04-01 09:10:00 +02:00

These files are example lua scripts that can be customized
if necessary.

They can be loaded with the 'lua-load' keyword like this:

    lua-load /path/to/lua_script.lua