For-As Loop
When you only want to iterate over the values of a table, you can use Pluto's for-as syntax.
New Codepluto
local t = { 1, 2, 3, "hello", "world" }for t as value doprint(value)end--> 1--> 2--> 3--> hello--> world
That code is identical to this:
Old Codepluto
local t = { 1, 2, 3, "hello", "world" }for _, value in t doprint(value)end
info
The bytecode of this feature is only backwards-compatible with Lua when pairs
, ipairs
, or next
is used. See Generalized Iteration.