Changeset

10981:e6c1e92cc7a7

util.timer: Defer to selected net.server if it implements this API E.g. net.server_epoll is very close and could easily be adapted to support this.
author Kim Alvefur <zash@zash.se>
date Mon, 29 Jun 2020 16:37:58 +0200
parents 10980:eaee72c7afbd
children 10982:276f16101d59
files util/timer.lua
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/timer.lua	Mon Jun 29 12:51:28 2020 +0100
+++ b/util/timer.lua	Mon Jun 29 16:37:58 2020 +0200
@@ -16,6 +16,11 @@
 local xpcall = require "util.xpcall".xpcall;
 local math_max = math.max;
 
+if server.timer then
+	-- The selected net.server implements this API, so defer to that
+	return server.timer;
+end
+
 local _ENV = nil;
 -- luacheck: std none