Printing/returning all table names in a module script

So I have a module script with emotes for players and I want to get all the module’s table names if the player chats :emotes. How do I get the table names?

Module code:

local module = {}

module[":emote Dance1"] = {
	
	AnimID = "rbxassetid://0";
	
}

module[":emote Dance2"] = {

	AnimID = "rbxassetid://0";

}

module[":emote Dance3"] = {

	AnimID = "rbxassetid://0";

}

return module

I’ve tried looking at the table.whatever functions but nothing there seems to be much of a help.

2 Likes

its a table/dictionary, so shouldn’t something like this work:

local EmoteModule = require(--[[Wherever the module script is]])
local Names = {}

for name, value in pairs(EmoteModule) do
    table.insert(Names, name)
    print(name)
end

1 Like

Let’s say i made a module like this;

local module = {}
module["TheName"] = {MyValue1 = "Hello"}

return module

Script;

local module = require()

for name, value in pairs(module) do
	print(name)
	print(value)
end

Output;

TheName
{["MyValue1"] = "Hello"}
1 Like