Logo

Programming-Idioms

History of Idiom 165 > diff from v20 to v21

Edit summary for version 21 by Kng:
New Lua implementation by user [Kng]

Version 20

2018-02-13, 17:51:23

Version 21

2018-04-03, 08:45:23

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Code
local x = items[#items]
Comments bubble
Gets the last sequential item
Doc URL
https://www.lua.org/manual/5.3/manual.html#3.4.7