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: How can i use a Module for tables?

Previous Thread :: Next Thread 
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:36 AM
I have a script that has a table that has the storage of some stuff but the script is little bit confusing at times but i can read it and i just want to know how to insert it into a module script so i can require that instead?

Like so:

table.insert(x,t)

But i want x to be in a module, help anyone?


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:37 AM
Like the table insert is from a server script


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:43 AM
bump


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
20 Feb 2016 08:46 AM
make a function in the module that has something like this


--module script
local module = {}

function module:InsertTable(Table)
module.Table = Table
end

return module

then in a server script:

local core = require ( game.ServerStorage.ModuleScript)-- change location to fit u

local Table = {1,2,3,4}-- for example

core:InsertTable(Table)

for k,v in pairs(core.Table) do
print (k)
end

try that



#Strikin'
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:47 AM
alright ill try that


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:51 AM
Wait, does it insert 1,2,3,4 from the server script into the module? Correct?


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
20 Feb 2016 08:53 AM
it inserts a table, with the values 1,2,3,4 in this case



#Strikin'
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:54 AM
Alrighty, thanks, and i can insert something into that table in the server script and it will still be put into the module?


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 08:59 AM
Like i need it so it does something like this:

Server script:


local core = require(script.ModuleScript)-- change location to fit u

local Table = {1,2,3,4,""}-- for example

core:InsertTable(Table)

table.insert(Table,"Gav")

for k,v in pairs(core.Table) do
print(k)
end


Module script:


local module = {}
function module:InsertTable(Table)
module.Table = Table
end
return module

But in the output it counts up to 6


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
ElectoStriking is not online. ElectoStriking
Joined: 10 May 2014
Total Posts: 1547
20 Feb 2016 09:35 AM
no you would have to do:

table.insert(core.Table,value)





#Strikin'
Report Abuse
GavAttack15 is not online. GavAttack15
Joined: 05 Oct 2013
Total Posts: 67
20 Feb 2016 09:57 AM
got it, thanks


local strings = [[string.ClutchDeveloper() and string.GavAttack12()]]
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
20 Feb 2016 10:11 AM
You can return mixed tables?
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