Iffix
|
  |
| Joined: 27 Sep 2013 |
| Total Posts: 484 |
|
|
| 18 Mar 2014 09:10 PM |
I can find all the variables at once and change them.
Can I do that? If so, how?
thanks. |
|
|
| Report Abuse |
|
|
lowvillan
|
  |
| Joined: 14 Sep 2010 |
| Total Posts: 725 |
|
|
| 18 Mar 2014 09:11 PM |
As previously stated, no. srry |
|
|
| Report Abuse |
|
|
Iffix
|
  |
| Joined: 27 Sep 2013 |
| Total Posts: 484 |
|
|
| 18 Mar 2014 09:11 PM |
| oh you're here too. posted in two forums for 2x help. |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 09:15 PM |
Use a for loop,dur
for I,v in pairs(Workspace:GetChildren()) do--change workspace to Workspace.ModelName if there in a model.. ypcall(v.Value = v.Value+1) end |
|
|
| Report Abuse |
|
|
xPoloBear
|
  |
| Joined: 10 Oct 2011 |
| Total Posts: 202 |
|
| |
|
|
| 18 Mar 2014 09:22 PM |
Will continue the script,regardless of errors Workspace -Part -NumberValue
for I,v in pairs(Workspace:GetChildren()) do ypcall(print (v.Value)) end
Part has no "Value" so without ypcall,it'd stop it cold.. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 18 Mar 2014 10:01 PM |
/\ If they are variables,won't they need to be in a table? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:02 PM |
| Not if they are global variables (non-local) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:08 PM |
| Well actually, I'm half-wrong. All global-variables are stored in the environment, which is a table. |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:08 PM |
Ok..but u can't exactly say
for I,v in pairs (_G) do Can you? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:09 PM |
| Not talking about the Global table, but you can do that |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:09 PM |
@island Actually, you can =P |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:10 PM |
Really? Like.. _G.a = 1 _G.b = 2 for I,v in pairs(_G) do print (v) end |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:11 PM |
_G.a = 1 _G.b = 2 for i,v in pairs(_G) do print(i,v) end
>a 1 b 2
=P |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:12 PM |
| Yeah, but I wasn't talking about things in the global table, I was talking about global variables (like: a = 5 or part = workspace.Part) |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:12 PM |
Declaring a global variable is much like doing this:
_B = {} rawset(_B, "a", 1) |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:14 PM |
Wow.. After some thought(I only recently started using tables ok?:3) _G is a table.. So,yeah..that's just.. Awesome :P So this would work?
_G.Hello = "Hi" _G.GoodBye = "By"
for I,v in pairs(_G) do print (I.."'s Meaning is",v) end -Hello's value is Hi -GoodBye's value is By |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:14 PM |
| you mean a key-value pair in the global table? |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:16 PM |
| Oop,meant to change "Meaning" to value |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 18 Mar 2014 10:19 PM |
Anways This got really sidetracked OP asked: Is there any way to FIND ALL THE VARIABLES AND CHANGE THE VALUES? Unless u use a table or the _G table,I doubt it.. Unless you define ea,h one |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Mar 2014 10:21 PM |
| You can if they are global variables (not making the variable local) |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:22 PM |
Like
_G.a = 1 _G.b = 2
for I,v in pairs(_G) do --I.v = 1 probly rong --I = 1 --v = 1 end |
|
|
| Report Abuse |
|
|
|
| 18 Mar 2014 10:23 PM |
@cnt No. This is practically the same thing: _G.bob = "hi"
_B = {} rawset(_B, "bob", "hi")
print(_G.bob) print(_B.bob)
See what I'm trying to get at? |
|
|
| Report Abuse |
|
|