comparison util/timer.lua @ 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 acf74ad0b795
children 2cdcf55c6dd5
comparison
equal deleted inserted replaced
10980:eaee72c7afbd 10981:e6c1e92cc7a7
13 local type = type; 13 local type = type;
14 local debug_traceback = debug.traceback; 14 local debug_traceback = debug.traceback;
15 local tostring = tostring; 15 local tostring = tostring;
16 local xpcall = require "util.xpcall".xpcall; 16 local xpcall = require "util.xpcall".xpcall;
17 local math_max = math.max; 17 local math_max = math.max;
18
19 if server.timer then
20 -- The selected net.server implements this API, so defer to that
21 return server.timer;
22 end
18 23
19 local _ENV = nil; 24 local _ENV = nil;
20 -- luacheck: std none 25 -- luacheck: std none
21 26
22 local _add_task = server.add_task; 27 local _add_task = server.add_task;