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 » Scripting Helpers
Home Search
 

Re: Help with Module Script? :P

Previous Thread :: Next Thread 
Veltamax is not online. Veltamax
Joined: 06 May 2012
Total Posts: 368
18 Aug 2014 02:32 PM
Could someone help me with this? I can't get this stupid module script to do what I want. So basically I want to store a table somewhere, that when you open a program, it will add that program to the table. I've come up with that the only way to do this is with a Module Script. If there is another way, PLEASE TELL ME. Anyway, so, this is the little section of the script to require the module script.

local OpenProgramsModule = require(veltumpc.OpenPrograms)
openprograms.insert(script.Parent.Name) --Apparently openprograms is nil?

ENTIRE MODULE SCRIPT:

local openprograms = {}

openprograms.insert = function(program)
table.insert(openprograms, program)
print("insert")
print(#openprograms .. " programs are open")
end

openprograms.recant = function(pprogram)
table.remove(openprograms, pprogram)
print("recant")
print(#openprograms .. " programs are open")
end

return OpenProgramsModule

The issue is in the section in the script section, it says that the openprograms is nil.

If anyone knows any other way to do this or any way to make this work, PLEASE help me! I don't really know how to use module scripts much at all. :\
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
18 Aug 2014 02:39 PM
Looks like you've gotten some of your variables mixed up. Try this:

local openprograms = require(veltumpc.OpenPrograms)
openprograms.insert(script.Parent.Name)

ENTIRE MODULE SCRIPT:

local openprograms = {}
local OpenProgramsModule = {}

OpenProgramsModule.insert = function(program)
table.insert(openprograms, program)
print("insert")
print(#openprograms .. " programs are open")
end

OpenProgramsModule.recant = function(pprogram)
table.remove(openprograms, pprogram)
print("recant")
print(#openprograms .. " programs are open")
end

return OpenProgramsModule

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Veltamax is not online. Veltamax
Joined: 06 May 2012
Total Posts: 368
19 Aug 2014 05:17 PM
You see, I only want one table. :\
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
19 Aug 2014 11:32 PM
If you don't mind me asking, why? Is there a problem with using two?

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
20 Aug 2014 02:30 AM
local openprograms = require(veltumpc.OpenPrograms) -- OpenProgramsModule == veltumpc.OpenPrograms, require(veltumpc.OpenPrograms) returns openprograms table
openprograms.insert(script.Parent.Name) --Apparently openprograms is nil?

ENTIRE MODULE SCRIPT:

local openprograms = {}

openprograms.insert = function(program)
table.insert(openprograms, program)
print("insert")
print(#openprograms .. " programs are open")
end

openprograms.recant = function(pprogram)
table.remove(openprograms, pprogram)
print("recant")
print(#openprograms .. " programs are open")
end

return OpenProgramsModule
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
20 Aug 2014 02:33 AM
I derped

local openprograms = require(veltumpc.OpenPrograms) -- OpenProgramsModule == veltumpc.OpenPrograms, require(veltumpc.OpenPrograms) returns openprograms table
openprograms.insert(script.Parent.Name) --Apparently openprograms is nil?

ENTIRE MODULE SCRIPT:

local openprograms = {}

openprograms.insert = function(program)
table.insert(openprograms, program)
print("insert")
print(#openprograms .. " programs are open")
end

openprograms.recant = function(pprogram)
table.remove(openprograms, pprogram)
print("recant")
print(#openprograms .. " programs are open")
end

return openprograms
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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