How to use vs code and modules within modules?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I am attempting to put a module script inside another module script but I use vs code/rojo so when I drag a .lua file into another .lua file it does not let me place it inside it which is annoying since I prefer having modules nested inside instead of using a lot of folders. I apologize if this is not the right category but I couldnt think where to put this.

You cannot put scripts inside other scripts in VSCode or Explorer/Finder/whatever file explorer program you use, I believe it’s only possible inside Studio.

.rbxlx To Rojo has a solution to it using folders, but I don’t know how it tricks Rojo into thinking it’s a script with modules, scripts and etc inside it.

1 Like

If you want to place a module inside of a module, your file-system structure will need to look like this, given ModuleA and ModuleB:

ModuleA (Folder)
   init.lua (ModuleA)
   ModuleB.lua

For more information, read the rojo documentation here.

7 Likes