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: Table Values

Previous Thread :: Next Thread 
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:42 PM
Is this right?

The script:

TableValue = game.Lighting.TableNumber.Value
table = {"..TableValue.."}
print(TableValue)

The Value in Lighting:

2,3,4,5,6,7,8,9,10

Is that right? I'm just finding another way defining tables throught objects instead of writing it onto scripts. If you don't understand what I'm talking about, please inform me.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:42 PM
through*
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
23 May 2012 03:46 PM
No, you'd have to do some string manipulation and seperately insert each value into a predefined table. Maybe something like this.

function TableObject(string)
local tableObject = {}
local values = (get all values in string)
for _, v in pairs(values) do
table.insert(tableObject,v)
end
return tableObject
end

myTable = TableObject("1, 2, 3")
Report Abuse
C0D3Y is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
23 May 2012 03:47 PM
Um me? I don't understand what you're talking about...
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:47 PM
@Epic

I just need to find a value from Lighting (which I referred) and define that value onto my script...
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
23 May 2012 03:49 PM
Like I said, if it's a string, you're gonna have to do some string manipulation.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:50 PM
Oh. I get it.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
23 May 2012 03:54 PM
TableValue = game.Lighting.TableNumber.Value
Table = { }

for M in TableValue:gmatch("(%d+),?") do
table.insert(Table, tonumber(M))
end

print(TableValue)
print( table.concat(Table, ", ") )





You should have two identical lines in the Output.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:54 PM
@Epic

Like this?

function TableObject(string)
local tableObject = {}
local values = (game.Workspace.Values.Value)--Just an example of finding where the value are
for _, v in pairs(values) do
table.insert(tableObject,v)
end
return tableObject
end

myTable = TableObject("LOL,Trollz,Iliketrainz")

NOTE: I'm just trying to learn.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
23 May 2012 03:57 PM
@AFF

Isn't it really effiecient if you wrote "one,two,three" on a string value and define it on a script?

table = script.Parent.Values.Value

Will it work?
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
23 May 2012 04:31 PM
Hey AFF, just curious, would that work for a command...like...

teleme(1,2,3) --player chat
x,y,z = --how would i retrieve x=1, y=2, and z=3?
player:MoveTo(Vector3.new(x,y,z))
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
23 May 2012 09:54 PM
"
@AFF

Isn't it really effiecient if you wrote "one,two,three" on a string value and define it on a script?

table = script.Parent.Values.Value

Will it work?
"
____________________________________________

No.



"
Hey AFF, just curious, would that work for a command...like...

teleme(1,2,3) --player chat
x,y,z = --how would i retrieve x=1, y=2, and z=3?
player:MoveTo(Vector3.new(x,y,z))
"
_____________________________________________

msg = "teleme(1, 2, 3)"
local x, y, z = string.match(msg,
  "teleme%(%D*(%d+%.?%d*)%D*(%d+%.?%d*)%D*(%d+%.?%d*)%D*%)"
)
print(x, y, z)
player:MoveTo(Vector3.new(x, y, z))
Report Abuse
oxcool1 is not online. oxcool1
Joined: 05 Nov 2009
Total Posts: 15444
24 May 2012 06:23 AM
[ Content Deleted ]
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
24 May 2012 03:25 PM
Thanks oxcool and AFF. I am trying to learn string patterns.
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
27 May 2012 02:52 PM
Thanks oxcool. That was what I was looking for. Thanks.
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