Answers for "index in lua"

Lua
0

lua indexof

table.indexOf = function ( tab, value )
  for index, val in ipairs(tab) do
    if value == val then
      return index
    else
      return -1
    end
  end
end
Posted by: Guest on December-14-2020

Browse Popular Code Answers by Language