Answers for "for loop with next() lua"

Lua
17

lua for loop

-- For K,V in table
for k,v in pairs(tbl) do
 print(k)
 print(v)
end
-- For i=0, num
for i=0, num do
 print(i)  
end
Posted by: Guest on April-17-2020
0

for loop with next() lua

-- Next loops are pretty simple.
-- It's exactly like a pairs loop.

for key, value in next, table do
	print(key, value)
end
Posted by: Guest on July-14-2021

Browse Popular Code Answers by Language