how to print items of table in roblox code example

Example 1: table.length roblox

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

Example 2: create a dictionary in roblox

-- Add a Module Script into the ServerScriptStorage

local speechMod = {}

	speechMod.speech = {
		["quest1"] = {	
			["line1"] = "Hi this is quest 1",
			["line2"] = "I have a Quest for you",
			["line3"] = "Come back when your done"
		}, -- end quest1
	
		["quest2"] = {	
			["line1"] = "Hi this is quest 2",
			["line2"] = "You have completed quest 1, great",
			["line3"] = "Get me some Food bro"
		} -- end quest2
	} -- end speechMod.speech


return speechMod

-- LUA Scripting Language (For Making Games in Roblox)

Tags:

Misc Example