Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

i want to print the "hello1" in this table, how do i fix this?

here is the copy im trying

local Table = {["hello1"] = "hello2"}

I cant seem to do it right and im not sure how i can fix this

2 answers

Hello there. This is not a table but a dictionary. This is a table:

local Table = {"Hello", "Hello12"};

This is a dictionary:

local Dic = {["hello there"] = 23};

To fix this issue you're having, you can use a loop in this case.

for index, value in pairs(Dic) do
print(index, value)
-- this will print hello there = 23

I hope this helped you to understand a bit more.

3 comments

0

ohh thank you i understand it now

0

That is a table. Dictionaries are a type of table, the Table is an array.

0

This is not a table but a dictionary. It's a table. >~< Btw, you could just retrieve the value via its index. An example of this's print(Table[Index]) --> Whatever It's Defined As

Probably want to do it in a loop. Something like this:

local myTable = {["hello1"] = "hello2"}

for key, value in pairs(myTable) do
	print(key)
	print(value)
	print()
end

This discussion is preserved as it was. New answers, comments, and votes are closed.