This is my first time posting and I’m a very new dev so sorry if I did something wrong with this post
Is it possible for a module to have the same functions as a child module. For example ExampleModule:ExampleFunction() instead of ExampleModule.ChildModule:ExampleFunction()
How would I achieve this?
I’ve tried looking on the dev forum for a post similar to this and I could not find one but maybe that’s a issue with my phrasing. I’ve also tried setting the module equal to the parent.
local RS = game:GetService("ReplicatedStorage")
local Module = require(RS.Module)
local ChildModule = require(RS.Module.ChildModule)
Module:Example()
ChildModule:Example()
local Module = {}
function Module:Example()
print("Hey I am Module")
end
return Module
local ChildModule = {}
function ChildModule:Example()
print("Hey I am Child Module")
end
return ChildModule
No no I’m looking more for the two modules sharing the same functions instead of two modules with different functions. I was watching Davidii’s stream and he had local DungeonFeature = Class:Extend() instead of what I usually thought modules had which would be like DungeonFeature = {} so I thought that there was one main module that contains the functions of all the children as the function was called Extend or something like that
no no like I think it was for organization as having all the functions in one module would lead to super long modules but he still wants to access all the children’s module functions from one module
Hm… but why would you need to rewrite the function? The purpose of ModuleScript is to have something like “shared” things that you can use outside of the ModuleScript.