Skip to content

Count votes in a tmux pane from Lua control mode - #181

Merged
tony merged 1 commit into
masterfrom
vote-counter-demo
Dec 6, 2026
Merged

tony merged 1 commit into
masterfrom
vote-counter-demo

Conversation

@tony

@tony tony commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Run lua examples/api/vote_counter.lua no yes no with tmux 3.7 or newer on PATH. The program sends each vote to an awk process in its own pane and reads each complete tally through a live control-mode watch.

The example shares one five-second deadline across each vote’s send and reply and bounds the bytes it reads. The installed example check verifies the output for the default votes.

Run the demo

Build the checkout rock and install the standalone luv adapter dependency. Example setup.

$ lua examples/api/vote_counter.lua no yes no
no -> yes=0 no=1
yes -> yes=1 no=1
no -> yes=1 no=2

To choose a particular tmux build, set TMUX_BIN to the executable’s absolute path. Runtime PATH support.

I also installed the released 0.1.1-1 rock from LuaRocks and ran the vote loop on tmux 3.7 and 3.8. For the release, I used runtime:connect with the private socket from the release’s example launcher. Both runs read the three tallies from awk. This branch creates its private server with runtime:start_server. Published package · Release launcher.

Test plan

  • Run the demo with TMUX_BIN unset on Lua 5.1.5 with tmux 3.7 and Lua 5.5.1 with tmux 3.8. Both printed the tallies above.
  • Verify the control-mode floor error on tmux 3.3a. An absolute tmux 3.8 override also ran the demo with tmux 3.3a on PATH.
  • Run luajit scripts/support/run_tests.lua scripts/docs/tests/test_api_examples.lua and verify that the default votes end at yes=2 no=1.
  • Pass the docs and format gates. Run the PATH discovery integration and the LuaLS and Neovim editor checks with the floor and current toolchains.

Hosted checks.

Related to #84.

why:
A Lua caller can send several votes and read the result through a live
control-mode watch.

what:
- Add the runnable vote counter to the installed examples and check its
  final count.
@tony
tony force-pushed the path-discovery-current branch from 0eb59ce to 7651143 Compare December 6, 2026 14:22
@tony
tony force-pushed the vote-counter-demo branch from c48d1e5 to d7f3165 Compare December 6, 2026 14:22
@tony
tony changed the base branch from path-discovery-current to master December 6, 2026 14:30
@tony
tony merged commit 8678234 into master Dec 6, 2026
12 checks passed
@tony
tony deleted the vote-counter-demo branch December 6, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant