Route a command through scalar branch logic while replay shows the selected path.

dispatcher branch Branch-based dispatch avoids stored function values and keeps Lua replay scalar.

Dispatcher Branch Panel

mode
dispatcher_branch_panel.lua
Replay: real traced execution (multi-file project)
local mode = "status"
local access = "ok"
local handled = ""

if mode == "refresh" then
  handled = "cache:" .. mode
elseif mode == "archive" then
  access = "review"
  handled = "queue:" .. mode
else
  handled = "handled:" .. mode
end

print("mode=" .. mode)
print("access=" .. access)
print(handled)
local mode = "refresh"
local access = "ok"
local handled = ""

if mode == "refresh" then
  handled = "cache:" .. mode
elseif mode == "archive" then
  access = "review"
  handled = "queue:" .. mode
else
  handled = "handled:" .. mode
end

print("mode=" .. mode)
print("access=" .. access)
print(handled)
local mode = "archive"
local access = "ok"
local handled = ""

if mode == "refresh" then
  handled = "cache:" .. mode
elseif mode == "archive" then
  access = "review"
  handled = "queue:" .. mode
else
  handled = "handled:" .. mode
end

print("mode=" .. mode)
print("access=" .. access)
print(handled)
  1. mode ← status, access ← ok, handled ← (empty)

    1local mode→ status = "status" --@mode="refresh", "archive"2local access→ ok = "ok"3local handled→ (empty) = ""
  2. handled ← handled:status

    9  handled = "queue:" .. mode10else11  handled→ handled:status = "handled:" .. modestatus12end
  3. print("mode=" .. mode)

    14print("mode=" .. modestatus)15print("access=" .. accessok)16print(handledhandled:status)
    outputmode=status
    access=ok
    handled:status
  1. mode ← refresh, access ← ok, handled ← (empty)

    1local mode→ refresh = "refresh"2local access→ ok = "ok"3local handled→ (empty) = ""
  2. handled ← cache:refresh

    5if moderefresh == "refresh" then6  handled→ cache:refresh = "cache:" .. moderefresh7elseif mode == "archive" then
  3. print("mode=" .. mode)

    14print("mode=" .. moderefresh)15print("access=" .. accessok)16print(handledcache:refresh)
    outputmode=refresh
    access=ok
    cache:refresh
  1. mode ← archive, access ← ok, handled ← (empty)

    1local mode→ archive = "archive"2local access→ ok = "ok"3local handled→ (empty) = ""
  2. access ← review, handled ← queue:archive

    6  handled = "cache:" .. mode7elseif modearchive == "archive" then8  access→ review = "review"9  handled→ queue:archive = "queue:" .. modearchive10else
  3. print("mode=" .. mode)

    14print("mode=" .. modearchive)15print("access=" .. accessreview)16print(handledqueue:archive)
    outputmode=archive
    access=review
    queue:archive