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
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
|
| 24 May 2012 03:25 PM |
| Thanks oxcool and AFF. I am trying to learn string patterns. |
|
|
| Report Abuse |
|
|
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 |
|
|