What are keys and indexes?

Is it the same or are they different?

Keys typically represent dictionary string keys (eg [“cheese”])
Indexes represent the number indices of arrays (eg 1 2 3 4 5)

Keys are indexes to get a value in a table and index returns the number of values?

“Key” is the general term given to the “name” of a value in a table
An integer (or number) key is called an index

So “key” describes the “name” of a value in a table, dictionary or array
“index” solely describes the “name” of a value in an array, given by a number

local Table = {"Red", "Green", "Blue"} 

The Colors of the Table are Values and 1 2 3 are the indices?


A couple more examples would be

local array = {"a","b","c"} --1 2 3 are indices

local dictionary = {a="b",c="d"} --a and c are keys
1 Like

Why don’t you search at http://developer.roblox.com for the answer? You should search before you even ask.

ok i searched on a lua website before making this post