-
What do you want to achieve?
I want to make a GUI for every index in a table using both the name of the index and the value. -
What is the issue?
I can only return the value of an index and not the indexes name. -
What solutions have you tried so far?
I have looked for solutions but came up short.
Is there any way you can get the name of the index in a table? Here is my table – it is in a module script. I need to get the name and the value so I can see what the player needs to create a certain item in the game. e.g. I can print “stone 5” but cannot get “Stone Wall”. I need to be able to get both.
local module = {
--walls
["Stone Wall"] = "stone 5";
["Wood Wall"] = "wood 5";
["Steel Wall"] = "steel 8";
["Leaf Wall"] = "leaf 5";
--detailed items
["Desk"] = "wood 3";
["Chair"] = "wood 2";
["Light Source"] = "steel 2";
["Bed"] = "wood 2 leaf 2";
--Doors
["Leaf Door"] = "leaf 3";
["Wood Door"] = "wood 3";
["Stone Door"] = "stone 3";
["Steel Door"] = "steel 3";
}