|
| 30 Aug 2016 10:40 PM |
I have never really used them so I don't know.
Would enjoy learning what they are used for, thank you. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 30 Aug 2016 10:42 PM |
being modular
and modularity is good!1!111
|
|
|
| Report Abuse |
|
|
| |
|
|
| 30 Aug 2016 10:56 PM |
| From what I understand, You can write a function from a modular script and use it in any script when you call the modularscript |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2016 11:44 PM |
module scripts are handy ways of storing functions,tables,metatables
it can store a lot of things
and if you make all of your variables global
and return the
getfenv()
you can use this to set the environment of your script to match the one in the Module Script, allowing you to use all the functions, tables, or data you stored inside of it
for k,v in pairs(require(moduleScript)) do getfenv()[k] = v end |
|
|
| Report Abuse |
|
|
Crimsonal
|
  |
| Joined: 23 Apr 2011 |
| Total Posts: 1795 |
|
|
| 31 Aug 2016 12:50 AM |
| Prevent you from having to rewrite functions, variables, in multiple scripts I'm assuming. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 12:51 AM |
what daily said would be an awful idea. Return a table and do that if you really want to. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 12:59 AM |
| no mine is not a bad idea because if you return getfenv() and then set the fenv, all of your module script's functions and variables will be automatically declared into your script |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:00 AM |
And so will the "script" variable and now you've ruined everything. You can just as easily put the functions in a table and return the table, then put all things in the table in the environment.
You're not good at this. |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 31 Aug 2016 01:02 AM |
dailyblarg is not smart111 :D
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:03 AM |
you can put them all in the environment with messy code such as this local bla,bla,bla,bla,bla = ms.bla,ms.bla,ms.bla,ms.bla
and it is much easier to just get and set everything in one go
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:04 AM |
| Wrong, you wouldn't be putting it in the environment if you did that. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:06 AM |
you can still simply just do
if k ~= "script" then
end
and there you go now all of it is replaced |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:09 AM |
| Or, you can just put them in a table like a normal person would. |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:11 AM |
that is a waste of code though
what if you store about 50 functions of frameworks inside that module script
it would make more sense to make an autoupdating and self-inserting code to add those functions onto there instead of having to manually declare all of the 50 functions in every script |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:12 AM |
"that is a waste of code though" You're really, really stupid. 'waste of code' lmfao
"what if you store about 50 functions of frameworks inside that module script" Yet again, you're stupid. '50 functions of frameworks' you're so ignorant when it comes to programming it hurts.
"it would make more sense to make an autoupdating and self-inserting code to add those functions onto there instead of having to manually declare all of the 50 functions in every script" How is that relevant to anything I said stupid? |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:16 AM |
| because you said that we should waste our time filling tables with loads of things to return rather than getting everything we need to return and loading it again |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:17 AM |
Yet again you don't understand anything. Here I'll spell it out for your dumb self:
local module = {} function module.Func1() .. end function module.Func2() .. end return module |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:18 AM |
| you can still use the getfenv() method to recieve all of the returned values though which is what i was enforcing |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:20 AM |
-.- nope how the hell does "getfenv" give you any return values... why are you so clueless and speak as if you know what you're talking abuot |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:21 AM |
because, idiot
for k,v in pairs(require(module)) do getfenv()[k] = getfenv()[k] or v end
this will just store any of the items in your module script in this script |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:23 AM |
You're not getting the return values doing that, require gives you the return value. How dumb can you be? You're almost as bad as remasteredblox |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:24 AM |
"You're not getting the return values doing that, require gives you the return value" i used require to get the returned values tho..
???? |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:26 AM |
Exactly moron. This is what you said though "you can still use the getfenv() method to recieve all of the returned values" |
|
|
| Report Abuse |
|
|
|
| 31 Aug 2016 01:26 AM |
return{ Func1=function(self,args) print(args) end, }
#1 way fam
"me caveman rawr" - Me |
|
|
| Report Abuse |
|
|