Skip to content

Instantly share code, notes, and snippets.

@Dreomite
Created September 11, 2018 14:11
Show Gist options
  • Select an option

  • Save Dreomite/8b567cfcdab902445eee01eef300bd76 to your computer and use it in GitHub Desktop.

Select an option

Save Dreomite/8b567cfcdab902445eee01eef300bd76 to your computer and use it in GitHub Desktop.
local array_like_table = {
"You",
"are",
"a",
"heretic"
}
--[[
[1] = "You"
[2] = "are"
[3] = "a"
[4] = "heretic"
]]
local map_like_table = {
bae = "Sigmar",
blessing = "This ravaged body",
is_this_a_potion = true
}
--[[
["bae"] = "Sigmar"
["blessing"] = "This ravaged body"
["is_this_a_potion"] = true
]]
local mixed_table = {
"My",
"precious",
"comrades",
Bardin = true,
Sienna = true,
Kruber = true,
Kerillian = "Elf, you're doing it wrong!"
}
--[[
[1] = "My"
[2] = "precious"
[3] = "comrades"
["Bardin"] = true
["Sienna"] = true
["Kruber"] = true
["Kerillian"] = "Elf, you're doing it wrong!"
]]
-- But you can easily make array- and map-like tables mixed:
array_like_table.heretics_slain = 1342
--[[
[1] = "You"
[2] = "are"
[3] = "a"
[4] = "heretic"
["heretics_slain"] = 1342
]]
map_like_table[2] = "By the Hammer and the Bell!"
--[[
[2] = "By the Hammer and the Bell!"
["bae"] = "Sigmar"
["blessing"] = "This ravaged body"
["is_this_a_potion"] = true
]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment