From eaa823a5971bfd2e9cb38dd8f30fefee2da95c2e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 21 Feb 2015 10:36:37 +0100 Subject: util.*: Remove use of module() function, make all module functions local and return them in a table at the end --- util/throttle.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'util/throttle.lua') diff --git a/util/throttle.lua b/util/throttle.lua index 55e1d07b..3d3f5d2d 100644 --- a/util/throttle.lua +++ b/util/throttle.lua @@ -3,7 +3,7 @@ local gettime = require "socket".gettime; local setmetatable = setmetatable; local floor = math.floor; -module "throttle" +local _ENV = nil; local throttle = {}; local throttle_mt = { __index = throttle }; @@ -39,8 +39,10 @@ function throttle:poll(cost, split) end end -function create(max, period) +local function create(max, period) return setmetatable({ rate = max / period, max = max, t = 0, balance = max }, throttle_mt); end -return _M; +return { + create = create; +}; -- cgit v1.2.3