mirror of
https://github.com/mt-mods/controls.git
synced 2024-11-08 08:03:47 +01:00
27 lines
701 B
Lua
27 lines
701 B
Lua
controls = {
|
|
--util values
|
|
modpath = minetest.get_modpath("controls"),
|
|
testsmode = minetest.settings:get_bool("controls_enable_tests", false),
|
|
|
|
--location to store callbacks
|
|
registered_on_press = {},
|
|
registered_on_hold = {},
|
|
registered_on_release = {},
|
|
}
|
|
|
|
--api functions
|
|
function controls.register_on_press(callback)
|
|
table.insert(controls.registered_on_press, callback)
|
|
end
|
|
|
|
function controls.register_on_hold(callback)
|
|
table.insert(controls.registered_on_hold, callback)
|
|
end
|
|
|
|
function controls.register_on_release(callback)
|
|
table.insert(controls.registered_on_release, callback)
|
|
end
|
|
|
|
if(controls.testsmode) then
|
|
dofile(controls.modpath .. "/test.lua")
|
|
end |