movss Cheater Reputation: 0
Joined: 10 Feb 2018 Posts: 38
|
Posted: Sun Mar 04, 2018 9:11 am Post subject: two usefull functions shared |
|
|
this is a function that removes duplicate members in an array
Code: |
--lua 去重复,吃尾算法,OK
function (Array)--OK
for i=1,#Array do
for j=#Array,1,-1 do
if i==j then
table.remove(Array,j)
end
end
end
end
|
Add different members to the array
Code: |
--添加不重复的数组成员,OK
function insert(Array,m_body)
for i=1,#Array do
if i==m_body then
return
end
end
table.insert(Array,m_body)
end
|
they are simple ,but usefull
_________________
A wild programmer |
|