summaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/util.lua b/util.lua
index 5d31a2a..5fd41d3 100644
--- a/util.lua
+++ b/util.lua
@@ -1,5 +1,9 @@
update_hooks = {}
+function AddUpdateHook(f)
+ update_hooks[#update_hooks + 1] = f
+end
+
-- https://pico-8.fandom.com/wiki/Qsort
function qsort(a, c, l, r)
c, l, r = c or function(a, b) return a < b end, l or 1, r or #a
@@ -99,7 +103,7 @@ function _update_button_states(_dt)
end
end
end
-update_hooks[1] = _update_button_states
+AddUpdateHook(_update_button_states)
function button_just_pressed(id)
return _button_states[id] == "just_pressed"
end \ No newline at end of file