Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --返回下一个数组索引,如果到了数组末尾则返回第一个
- function next_i(l,i)
- i+=1
- if(i>#l)i=1
- return i
- end
- --寻找一下个active的项 索引
- function find_next_i(l,i,active_count)
- if active_count>=#l then
- return nil,0
- end
- local o=l[i]
- while o.active do
- i=next_i(l,i)
- o=l[i]
- end
- return o,i
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement