Module:Utils: Difference between revisions
Add index_of function |
m Forgot p |
||
Line 13: | Line 13: | ||
-- return the first index with the given value (or nil if not found) | -- return the first index with the given value (or nil if not found) | ||
function index_of(array, value) | function p.index_of(array, value) | ||
for i, v in ipairs(array) do | for i, v in ipairs(array) do | ||
if v == value then | if v == value then |