Question : lua for each in table
Answered by : orion
for k,v in pairs(table) do -- k is key -- v is value
end
Source : | Last Update : Tue, 24 Mar 20
Question : lua in pairs
Answered by : dangerous-dog-b3gesst17z7u
--Table is the table to iterate through
--Index is the current index
--Value is the value at the current index
for index, value in pairs(table) do
end
Source : | Last Update : Mon, 06 Jan 20
Question : for i in pairs lua
Answered by : drab-dingo-t3fg3tan6qjj
local table = {2,3,12, "Hello"} --a simple array
for i, item in pairs(table) do -- for i in pairs loop goes through all the items in an array/table print(item)
end
Source : | Last Update : Thu, 03 Sep 20
Question : lua counting
Answered by : dl--an-abbreviation-of-my-name
local cando = True
local number = 0
While cando do number = number + 1 print(number) wait(1)
Source : | Last Update : Mon, 21 Feb 22
Question : lua pairs
Answered by : breakable-buzzard-mnwlng6pzv4o
-- // 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
Source : | Last Update : Sun, 13 Feb 22