Is there any benefit to keeping only part of a module in your script's variables?

Sometimes, you only want to use some of the stuff in a module.
In these situations, I’m wondering if there is any benefit to doing this:

local Method1
local Method2

do

    local Module =  require(-path-)
    Method1 = Module.Method1
    Method2 =  Module.Method2

end

-- further down in the script...
Method1(args)
Method2(args)

rather than simply doing this:

local Module = require(-path-)

-- further down in the script...
Module.Method1(args)
Module.Method2(args)

It doesn’t seem like a huge difference other than the second one being easier but let me know.

1 Like

Depends. If you want to use Method1 and/or Method2 multiple times, use the first option. Otherwise, second option.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.