This lesson covers the basis of dictionaries

by Kut_ro

Author Avatar

This lesson is about dictionaries and how they work, what they look like, and

practical uses of them.

Let's start with the basics of a table:

awdawdlocal myTable = () --this is not a table
local myTable2 = [] --nor is this
local myTable3 = {} --[[this is a table. The indication for a table is pretty
clear, but in case you missed it, the squiggly lines called curly brackets is

what you use to make a table.]]--

local MyRandomTable = {"Hi", 2, true} --[[Tables can hold float/int values,
bool values, and strings. In short just reference the following]]--

String = "Text" --just text in quotations you can use '' or ""
Int/Float = 2 --Simply numbers
bool = true --True or false(nil)

--Now to index these tables you can simply do the following

print(MyRandomTable[1]) --[[this would print "Hi" in the output because tables
work numerically from left to right]]--

--What should we do if we have over 20 values stored in our table? The answer:


--[[Think of dictionaries like a dictionary itself, there's the word and the

definition. This works the same way in lua
, FE:]]--

local dictionary = {

Color = Color3.new(0, 255, 127),

Number = 2,

UnimportantWord = "StringedVortex" 

--There are other ways to write these values but this is way easier


--Notice how each value is assigned a word? That's because it works like a dictionary.

--And you index these values or reference back you can simple do this

dictionary.Color --or

--Examples of practical uses are self explanatory but i hope this tutorial


--And as always, Code on!

View in-game to comment, award, and more!