tables roblox code example

Example 1: table.length roblox

local table = {"Hello","World", 1, 5}
print(#table)
--Result: 4

Example 2: roblox get index position of tables

local F = {"your","my","we","yeet",}

for i, v in pairs(F) do
	print(i)
end

--Lua Script language

Example 3: roblox get values of tables

local myTable = {"your","my","we","yeet",}

for i, v in pairs(myTable) do
	print("Index: "..tostring(i))
	print("Value: "..tostring(v))
end

-- i stands for Index
-- v stands for Value
-- You can name these variables as you wish, but you should know,-
-- -the first is Index and the second is the Value
--Lua Script language

Tags:

Lua Example