You are reading a single comment by @dwallersv and its replies. Click here to read the full conversation.
  • Can other modules be used in a module with the require() statement? The writing your own modules page addresses this to some degree, but it wasn't entirely clear to me what would happen if, for instance, the same "core" module is referenced in several different modules.

    The scenario: I want to break up the GUI components I've been working on into separate modules so that only the elements being used can be individually referenced, saving space. So, I want to break the code up into a Button module, Slider module, Checkbox, Textbox, etc. All need a "core" set of functionality that would be included in each module.

    So, if you were to create an interface that used buttons and sliders, you would include just these components in your code like this:


    Each of those have in them,


    which, of course, is then getting called twice.

    Is this handled gracefully, the "right" way so there isn't duplication?


Avatar for dwallersv @dwallersv started