Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,106 questions

40,778 answers

573 users

How to create key value dictionary in Lua

1 Answer

0 votes
local dict = {
    ["lua"] = 3, 
    ["c"] = 9,
    ["java"] = 4,
    python = 6
}

for key, val in pairs(dict) do
    print(string.format("%s: %d", key, val))
end




--[[
run:

python: 6
c: 9
java: 4
lua: 3

--]]

 





answered Dec 11, 2022 by avibootz

Related questions

1 answer 46 views
1 answer 34 views
34 views asked Dec 21, 2022 by avibootz
1 answer 46 views
1 answer 107 views
107 views asked Sep 24, 2020 by avibootz
1 answer 125 views
125 views asked Sep 24, 2020 by avibootz
...