Module debounce
Create a debounced version of a function.
The returned function delays calling fn until delay seconds have
passed without any new calls. If the function is called again before
the delay expires, the timer resets. Only the last call executes.
Usage:
local update = debounce(2, function(player)
print("Updating for", player:get_player_name())
end)
update(player) -- will run 2 seconds after the last call