Software /
code /
prosody
Comparison
util/throttle.lua @ 4470:0209bd5c4259
util.throttle: Fix 'outstanding' return value
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 13 Jan 2012 23:30:32 +0000 |
parent | 4469:500735931677 |
child | 4952:0e9a5b63206a |
comparison
equal
deleted
inserted
replaced
4469:500735931677 | 4470:0209bd5c4259 |
---|---|
32 else | 32 else |
33 local balance = self.balance; | 33 local balance = self.balance; |
34 if split then | 34 if split then |
35 self.balance = 0; | 35 self.balance = 0; |
36 end | 36 end |
37 return false, balance, (cost-self.balance); | 37 return false, balance, (cost-balance); |
38 end | 38 end |
39 end | 39 end |
40 | 40 |
41 function create(max, period) | 41 function create(max, period) |
42 return setmetatable({ rate = max / period, max = max, t = 0, balance = max }, throttle_mt); | 42 return setmetatable({ rate = max / period, max = max, t = 0, balance = max }, throttle_mt); |