Software /
code /
prosody
Diff
util/throttle.lua @ 6777:5de6b93d0190
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Feb 2015 10:36:37 +0100 |
parent | 4952:0e9a5b63206a |
child | 7988:dc758422d896 |
line wrap: on
line diff
--- a/util/throttle.lua Mon Aug 10 22:16:05 2015 +0200 +++ b/util/throttle.lua Sat Feb 21 10:36:37 2015 +0100 @@ -3,7 +3,7 @@ local setmetatable = setmetatable; local floor = math.floor; -module "throttle" +local _ENV = nil; local throttle = {}; local throttle_mt = { __index = throttle }; @@ -39,8 +39,10 @@ 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; +};