generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Module scripts, please tell me more.

Previous Thread :: Next Thread 
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
10 Dec 2013 02:31 PM
Is it simply something like

require(helloworld)

or

include(helloworld)

I got these from my php work, can you guys please tell me how this new update works?
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
10 Dec 2013 02:42 PM
To require a ModuleScript:
local data = require(workspace.ModuleScript) --where workspace.ModuleScript is your ModuleScript

How ModuleScripts work in a nutshell:

return (some value) --Best usage I've seen for ModuleScritps is APIs, so an example would be: return {foo=function() print("foo") end; bar=function() print("bar") end;}

ModuleScripts run once on the client and once on the Server. (That is, it's run once and every call to Require() in different Scripts of the same type return the same value)
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
10 Dec 2013 02:45 PM
Thanks, I really appreciate it.
Report Abuse
MettaurSp is not online. MettaurSp
Joined: 20 Mar 2010
Total Posts: 3179
10 Dec 2013 05:18 PM
So basically they are like one possibly giant function you call with require? That will help a lot with a language I am working on.
Report Abuse
MemoryAddress is not online. MemoryAddress
Joined: 20 Apr 2013
Total Posts: 1297
10 Dec 2013 07:08 PM
[ Content Deleted ]
Report Abuse
RyanDolan123 is not online. RyanDolan123
Joined: 05 Mar 2009
Total Posts: 17919
10 Dec 2013 09:52 PM
Why not tuples @mem
Report Abuse
MemoryAddress is not online. MemoryAddress
Joined: 20 Apr 2013
Total Posts: 1297
11 Dec 2013 04:05 PM
[ Content Deleted ]
Report Abuse
BreachedSecurity is not online. BreachedSecurity
Joined: 18 Feb 2013
Total Posts: 156
11 Dec 2013 05:29 PM
Is there a way to have a multi-lined function in a table without using semicolons?
Report Abuse
MemoryAddress is not online. MemoryAddress
Joined: 20 Apr 2013
Total Posts: 1297
11 Dec 2013 05:56 PM
[ Content Deleted ]
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
11 Dec 2013 07:05 PM
Interesting discovery: the require function seems to be cached somehow. I require'd a module (via command line), then edited it to return something else, but it still gives me the original value back from the call.

~Jode
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
11 Dec 2013 09:36 PM
"require'd"

The English language just died.
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
11 Dec 2013 09:57 PM
@jode From what I've gathered ModuleScripts are only executed once and then just return the same value anytime require is used.

~The alpaca of the acting world.
Report Abuse
MettaurSp is not online. MettaurSp
Joined: 20 Mar 2010
Total Posts: 3179
11 Dec 2013 11:38 PM
When I update their source in studio and use require on them before and after doing so, they can return different values. Not much use for that info with the Source property being locked.
Report Abuse
Superwarrior360 is not online. Superwarrior360
Joined: 21 Feb 2013
Total Posts: 2703
21 Nov 2014 06:29 PM
I think this is incorrect grammar: "I require'd a module"

It should be, "I made a script require a module."
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
21 Nov 2014 07:03 PM
I required a module would work fine.
Report Abuse
VanillaLight is not online. VanillaLight
Joined: 02 Nov 2013
Total Posts: 834
21 Nov 2014 09:04 PM
necrobump...
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
21 Nov 2014 09:05 PM
Yeah :/
Report Abuse
5ZR is not online. 5ZR
Joined: 11 Dec 2012
Total Posts: 2218
25 Sep 2015 12:46 PM
hry
Report Abuse
ThisUserSecret is not online. ThisUserSecret
Joined: 29 Sep 2012
Total Posts: 1094
08 Dec 2015 04:44 PM
Necro bump because I can't seem to understand modules at all....
Report Abuse
Forever_Classic is not online. Forever_Classic
Joined: 24 Aug 2016
Total Posts: 33
03 Sep 2016 06:06 AM
yes
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image