Files
sporel-lib-management.launc…/fsm.lua
Calic 1aa2eb6a6a fix(P.3.4): self-contained fsm.lua, drop module-dep (resolver only handles libs)
Sporel resolver does NOT resolve module-as-dep (only lib-deps). Test-module
ships its own byte-identical copy of fsm.lua and loads it via dir_of(self).
Drift prevention deferred to Smoke diff-check (next slice).

Also dropped runtime-behavior measure_text assertion (needs Raylib font, not
loaded in headless test-mode). Existence-check (assertion 10) is sufficient.

11 assertions: 5 FSM transitions + 1 FSM stability + 5 Engine-Surface existence.
2026-05-12 23:25:16 +02:00

26 lines
855 B
Lua

-- Sporel Launcher — pure-Lua finite state machine.
-- No engine.* calls; testable directly by lib-sporel.launcher-test.
local M = {}
M.STATE_LIST = "list"
M.STATE_QUIT_CONFIRM = "quit_confirm"
M.EXIT = "exit" -- sentinel: caller should engine.exit(0)
-- Events: "esc", "enter", "click_yes", "click_no", "click_module"
function M.next(state, event)
if state == M.STATE_LIST then
if event == "esc" then return M.STATE_QUIT_CONFIRM end
return M.STATE_LIST
elseif state == M.STATE_QUIT_CONFIRM then
if event == "esc" then return M.STATE_LIST end
if event == "enter" then return M.EXIT end
if event == "click_yes" then return M.EXIT end
if event == "click_no" then return M.STATE_LIST end
return M.STATE_QUIT_CONFIRM
end
return state
end
return M