Sleitnick / AeroGameFramework

AeroGameFramework is a Roblox game framework that makes development easy and fun. The framework is designed to simplify the communication between modules and seamlessly bridge the gap between the server and client.
https://sleitnick.github.io/AeroGameFramework/
MIT License
215 stars 57 forks source link

Require module from another module? #178

Closed tacheometry closed 4 years ago

tacheometry commented 4 years ago

I'm making a module AnimHandler, but I need access to the AnimationIds module. Both are inside client>modules. Are there any injected properties I can use to access AnimationIds, or do I need to use _G.Aero?

spectrius commented 4 years ago

If both are placed directly in Client.Modules, you should be able to access AnimationIds by referencing self.Modules.AnimationIds or vice versa.

tacheometry commented 4 years ago

The problem is, referencing self doesn't give out the properties, instead, because I'm accessing it in a class module, it returns the object

spectrius commented 4 years ago

You can still get a reference to it by using self where it refers to the module itself. For example, you could put the reference in :Init(), which should work with all Aero-wrapped modules.

local AnimationIds

function AnimHandler.new()

end

function AnimHandler:Init()
    AnimationIds = self.Modules.AnimationIds
end
tacheometry commented 4 years ago

Thanks! Managed to get it working 😃