This lets you define bindings like h script-binding stats/display-page-4-toggle. Requested in #14966.
Showing the changes to player/lua/stats.lua (1 of 3 files). Show all
Unified · Split
| @@ -1750,14 +1750,20 @@ mp.add_key_binding(nil, "display-stats", function() process_key_binding(true) en · 1749 unmodified lines | ||
| 1750 | 1750 | mp.add_key_binding(nil, "display-stats-toggle", function() process_key_binding(false) end, |
| 1751 | 1751 | {repeatable=false}) |
| 1752 | 1752 | |
| 1753 | −-- Single invocation bindings without key, can be used in input.conf to create | |
| 1754 | −-- bindings for a specific page: "e script-binding stats/display-page-2" | |
| 1755 | 1753 | for k, _ in pairs(pages) do |
| 1756 | − mp.add_key_binding(nil, "display-page-" .. k, | |
| 1757 | − function() | |
| 1758 | − curr_page = k | |
| 1759 | − process_key_binding(true) | |
| 1760 | − end, {repeatable=true}) | |
| 1754 | + -- Single invocation key bindings for specific pages, e.g.: | |
| 1755 | + -- "e script-binding stats/display-page-2" | |
| 1756 | + mp.add_key_binding(nil, "display-page-" .. k, function() | |
| 1757 | + curr_page = k | |
| 1758 | + process_key_binding(true) | |
| 1759 | + end, {repeatable=true}) | |
| 1760 | + | |
| 1761 | + -- Key bindings to toggle a specific page, e.g.: | |
| 1762 | + -- "h script-binding stats/display-page-4-toggle". | |
| 1763 | + mp.add_key_binding(nil, "display-page-" .. k .. "-toggle", function() | |
| 1764 | + curr_page = k | |
| 1765 | + process_key_binding(false) | |
| 1766 | + end, {repeatable=true}) | |
| 1761 | 1767 | end |
| 1762 | 1768 | |
| 1763 | 1769 | -- Reprint stats immediately when VO was reconfigured, only when toggled |