Lua : Basit Bir For Loop Döngüsü.

Basit bir lua programlama örneği: occupants = {"Jones","Smith","Patel","Brown","Ng"} occupants[1] = "Roberts" occupants[6] = "Lee" occupants[9] = "Forsythe" occupants[8] =...

Basit bir lua programlama örneği:

occupants = {"Jones","Smith","Patel","Brown","Ng"}
occupants[1] = "Roberts"
occupants[6] = "Lee"
occupants[9] = "Forsythe"
occupants[8] = "Campbell"
occupants["llareggub"] = "Thomas"

-- indexed section - sequential from start

for dis,dat in ipairs(occupants) do
print (dis .. " - " .. dat)
end

-- whole thing

for dis,dat in pairs(occupants) do
print (dis .. " > " .. dat)
end

--[[ Sample output --------------------------------

[trainee@easterton nts]$ lua clike
1 - Roberts
2 - Smith
3 - Patel
4 - Brown
5 - Ng
6 - Lee
1 > Roberts
2 > Smith
3 > Patel
4 > Brown
5 > Ng
6 > Lee
8 > Campbell
9 > Forsythe
llareggub > Thomas
[trainee@easterton nts]$

]]
 
💬 SpyHackerz Telegram — Anlık tartışmalar ve duyurular için katıl
132,010Konular
3,273,985Mesajlar
316,754Kullanıcılar
mahoo12Son Üye
Üst Alt