Comparison

util/throttle.lua @ 4467:fc8a22936b3c

util.throttle: Fix 'outstanding' return value
author Matthew Wild <mwild1@gmail.com>
date Fri, 13 Jan 2012 23:30:32 +0000
parent 4466:28e0bf9cf0f5
child 4952:0e9a5b63206a
comparison
equal deleted inserted replaced
4466:28e0bf9cf0f5 4467:fc8a22936b3c
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);