diff options
| author | iamcheeseman <[email protected]> | 2026-03-12 15:34:21 -0400 |
|---|---|---|
| committer | iamcheeseman <[email protected]> | 2026-03-12 15:34:21 -0400 |
| commit | a73cc7bc2fb11f7099a59eafc73e2161bf807a84 (patch) | |
| tree | 5da51390d59b5e3df80b648783fc1dea4483a192 | |
| parent | bea27cd7f979ce3544b4c73855190efc2a9565ac (diff) | |
fix silly lil bug causing mener to cry
| -rw-r--r-- | conf.lua | 1 | ||||
| -rw-r--r-- | src/im.lua | 12 | ||||
| -rw-r--r-- | src/utils.lua | 6 |
3 files changed, 8 insertions, 11 deletions
@@ -2,4 +2,5 @@ function love.conf(t) t.window.title = "Gutshot" t.window.width = 320 * 3 t.window.height = 180 * 3 + t.window.vsync = 0 end @@ -315,11 +315,13 @@ function im.begin_window(title, x, y, w, h, opts) end if mouse_down and focused_win == win then - local last = pop(wins) - wins[win.idx] = last - last.idx = win.idx - table.insert(wins, win) - win.idx = #wins + if wins[#wins] ~= win then + local last = table.remove(wins) + wins[win.idx] = last + last.idx = win.idx + table.insert(wins, win) + win.idx = #wins + end end end diff --git a/src/utils.lua b/src/utils.lua index 33ca7e8..ec5d16e 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -18,12 +18,6 @@ function min(a, b) return b end -function pop(tbl) - local last = tbl[#tbl] - tbl[#tbl] = nil - return last -end - function normalize(x, y) if x == 0 and y == 0 then return 0, 0 |
