• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


30 Nov, 2024

Updated at 12 Dec, 2024

Inherit notes from modules?

So, I recently discovered
that what ever note you have above the line of a method/function in a module script, when the module is passed on, the script requiring it will be able to see the note that you have written:


Which is really helpful, cuz sometimes you can just forget what a method does, and when certain types don’t get passed through scripts.

But then i realized something, the notes only shows up for the First-Hand script that requires the module directly, but not the Second-Hand scripts, example:
A Module:

local Module = {}

-- prints 1
Module.Method1 = function()
   print(1)
end

return Module

A First-Hand script ( a script that requires “The Module” directly):

local The_Module = require(TheModule)

local FirstHand = {}
FirstHand.Method1 = The_Module.Method1 -- right here, it shows the note 

return FirstHand 

A Second-Hand script ( another script that requires “The FirstHand” script):

local The_FirstHand = require(The_FirstHand)

local SecondHand = {}
SecondHand.Method1 = The_FirstHand.Method1 -- this time, the note doesn't show up

return SecondHand 

What I’m trying to figure out is, is there anyways for the notes to still show up for Second-Hand scripts?

thx. :grinning:

1 post - 1 participant

Read full topic