Module:TableTools: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
imported>Sukanthi சி 1 திருத்தம் இறக்குமதி செய்யப்பட்டன |
imported>Ravidreams சி en:Module:TableTools இலிருந்து திருத்தம் இறக்குமதி செய்யப்பட்டன |
||
வரிசை 460:
-- inArray
--
-- Returns true if
-- Equivalent to JavaScript array.includes(searchElement) or
-- array.includes(searchElement, fromIndex), except fromIndex is 1 indexed
------------------------------------------------------------------------------------
function p.inArray(
checkType("inArray", 1,
-- if
fromIndex = tonumber(fromIndex)
for _, v in ipairs(arr) do▼
if (fromIndex < 0) then
return true▼
fromIndex = #array + fromIndex + 1
end
if fromIndex < 1 then fromIndex = 1 end
for _, v in ipairs({unpack(array, fromIndex)}) do
if v == searchElement then
▲ return true
end
end
else
if v == searchElement then
return true
end
end
end
| |||