Skip to content

Commit

Permalink
Merge pull request #63 from BHYCHIK/master
Browse files Browse the repository at this point in the history
Iterators instead of indexed access
  • Loading branch information
jirfag committed Sep 1, 2016
2 parents 85dc799 + 33eab44 commit 6eddd13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ussender.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ function ussender_add(user_id, sender_id)
if #selected == 0 then
box.insert(0, user_id, sender_id)
else
for i=1, #selected[1]-1 do
local cur_id = box.unpack("l", selected[1][i])
local fun, param, state = selected[1]:pairs()
state, _ = fun(param, state) -- skip the first element of tuple
for state, v in fun, param, state do
local cur_id = box.unpack("l", v)
if cur_id == sender_id then
return
end
Expand Down

0 comments on commit 6eddd13

Please sign in to comment.