about summary refs log tree commit diff stats
path: root/help.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-08-23 10:59:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-08-23 10:59:58 -0700
commit8057f3e8fe016ea054fa1c878e2c90b5ae32d1b6 (patch)
tree205b0fab4c1b3bf2edec6e0cd6dff63a190e950f /help.lua
parentce79623231a71d23b32d0c4bbaef0adba673e9fc (diff)
downloadview.love-8057f3e8fe016ea054fa1c878e2c90b5ae32d1b6.tar.gz
stop putting button state in a global
Symptom: a test (test_click_to_create_drawing) started randomly failing
after I inserted a `return` 2 commits ago.

Cause: my tests call edit.draw, but button handlers only get cleared in
app.draw. So my tests weren't clearing button handlers, and every call
to edit.draw was accumulating states. Still unclear why those were going
to different state objects after the `return`, but anyway. I'm not going
to understand every last thing that happens when things go wrong, just
guarantee they can't go wrong. And the way to do that is to decentralize
button handlers to each state that receives them.

The State object in buttons.lua doesn't have to be Editor_state. It just
has to be some table that provides a Schelling Point for shared state.
Diffstat (limited to 'help.lua')
0 files changed, 0 insertions, 0 deletions