Stop module script from returning a function

I have a folder called “Blocks” in the workspace and it has 3 models all named “Model” in it. I’m trying to use a module script to create a table that includes those 3 models for my server script.
Here’s the module script which creates the table:

local module = {}

module.createTable = function(foulder)
	local dictionary = foulder:GetChildren()
	for i, v in pairs(dictionary) do
		table.insert(module, v)
	end
end

return module

And here is what I have in the server script:

local module = {}

module.createTable = function(folder)
	local dictionary = folder:GetChildren()
	for i, v in pairs(dictionary) do
		table.insert(module, v)
	end
end

return module

This is what prints out:
output
I wouldn’t like to have the “function” in the table, but I don’t know any way to stop module script from adding it. Is the only way I can fix this to manually remove it from the table in the server script? Or should I not use module script for creating a tabe at all?

Thank you in advance!

Create a different table to hold the models or just return workspace.Folder:GetChildren().

Since you’re creating that method under module the function will always be there unless you remove it.

Also…

Despite it’s name, “createTable”, all it does is add the contents of one table to another. You should make your method names more clear to make your code more readable.

2 Likes

Thank you, I think I’m just not going to use the module as it’s not so useful :sweat_smile:

1 Like