class 'help_class' (Script)

function help_class:__init()super()

end
function help_class:on_attach()
-- local f=self.sor
-- self.arr={2,3,7,5,4,8,23,1,2,3,4,5,87,56 }
-- self:sortArr(self.arr,f)
end

function help_class:sor(a,b)
 if a>b then
  return true
 else
  return false
 end
end


-- функция сортировки масива
function help_class:sortArr(arr,fun,obj)

 for i=1,#arr-1 do
   for j=i+1,#arr do
   -- print(arr[i])
   -- print(arr[j])
    if fun(obj,arr[i],arr[j]) then
      -- print('hy')
       table.insert (arr,i,arr[j])
       table.remove(arr,j+1)
    end
   end
 end
 for k=1,#arr do
  print(arr[k])
 end
end



function help_class:randSort(arr)
 local arrIndex={}
 local arrRand={}
 local index
 for i=1,#arr do
  arrIndex[i]=i
 end
 for s=1,#arr do
  index=math.ceil(math.random(0,#arrIndex))+1
  arrRand[s]=arr[arrIndex[index]]
  table.remove(arrIndex,index)
 end
 arr=arrRand
end


