# HG changeset patch # User Kim Alvefur <zash@zash.se> # Date 1546176418 -3600 # Node ID c8240f931a68a66b7b23ec9bab073ab454cad263 # Parent 848fd204708ccc3dd840ab253148ee3fb94129df core.moduleapi: Move util imports to top diff -r 848fd204708c -r c8240f931a68 core/moduleapi.lua --- a/core/moduleapi.lua Sun Dec 30 12:55:58 2018 +0000 +++ b/core/moduleapi.lua Sun Dec 30 14:26:58 2018 +0100 @@ -14,6 +14,8 @@ local timer = require "util.timer"; local resolve_relative_path = require"util.paths".resolve_relative_path; local st = require "util.stanza"; +local cache = require "util.cache"; +local promise = require "util.promise"; local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat; local error, setmetatable, type = error, setmetatable, type; @@ -364,14 +366,14 @@ function api:send_iq(stanza, origin, timeout) local iq_cache = self._iq_cache; if not iq_cache then - iq_cache = require "util.cache".new(256, function (_, iq) + iq_cache = cache.new(256, function (_, iq) iq.reject("evicted"); self:unhook(iq.result_event, iq.result_handler); self:unhook(iq.error_event, iq.error_handler); end); self._iq_cache = iq_cache; end - return require "util.promise".new(function (resolve, reject) + return promise.new(function (resolve, reject) local event_type; if stanza.attr.from == self.host then event_type = "host";