LucasMZ_RBX
(SGUltraModernGirl)
January 3, 2021, 2:34pm
#1
So I have been making some modules which I publish here and there, basic ones but still.
And I wanted some tips, things that most people don’t go over on modules.
For example, what is “self”?
I wanted some tips for things like that so that I can make my modules better.
1 Like
Artoshia
(Artoshia)
January 3, 2021, 2:43pm
#2
So when you require a module. and then activate a function within a module,
When you hit module:HelloWorld(functionparam1)
What it will do is have a special hidden variable named self, self is the actual module in the first place.
Meaning you can do something like this:
-- Module
local module = {}
function module:Helloworld()
self.WHAT()
end
function module.WHAT()
print("Printed")
end
return module
--script
local Yes = require(script.ModuleScript)
Yes:Helloworld()
--result
> Printed
Edit:
If you feel this solved your problem be sure to mark it as such, helps me out
3 Likes
LucasMZ_RBX
(SGUltraModernGirl)
January 3, 2021, 4:06pm
#3
It isn’t a solution per-say, as I’m finding tecnics, and trying to learn so.
1 Like