Hey guys, I was just reading some code and then I encounter this:
Anyone know what this does and means and how it does it?
Any help appreciated
Thanks
Hey guys, I was just reading some code and then I encounter this:
Anyone know what this does and means and how it does it?
Any help appreciated
Thanks
What you’re looking at is a dictionary. To index things in a dictionary, just do:
dict[index]
You can use this to check if certain indexes exist in a table:
local dict = {
Dog = 1,
Cat = 2,
}
if dict["Man"] then
print("Man detected")
end
if dict["Dog"] then
print("Dog detected")
end
You can also index them via a period:
local dict = {
Dog = 1,
Cat = 2,
}
if dict.Man then
print("Man detected")
end
if dict.Dog then
print("Dog detected")
end
Thanks! This helped me to understand more.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.