Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

lua pairs

-- // Tables
local t = {"foo", "bar"}

--[[
	// Output:
	1 foo
	2 bar
--]]
for i,v in pairs(t) do
	print(i,v)
end


-- // Dictionaries
local t = {
	["A"] = "Me",
    ["B"] = "You"
}

--[[
	// Output:
	A Me
	B You
--]]
for i,v in pairs(t) do
	print(i, v)
end
 
PREVIOUS NEXT
Tagged: #lua #pairs
ADD COMMENT
Topic
Name
9+7 =