Anonymous

Module:FunList: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 103: Line 103:
-- Returns the first element of a sequence.
-- Returns the first element of a sequence.
function funlist.first()
function funlist:first()
for _, v in pairs(mytable) do
for _, v in pairs(mytable) do
return v
return v
Line 119: Line 119:
-- Returns the last element of a sequence.
-- Returns the last element of a sequence.
function funlist.last()
function funlist:last()
if funlist.any() == false then
if funlist.any() == false then
error('Sequence contains no items.')
error('Sequence contains no items.')
2,875

edits