15cups
|
  |
| Joined: 22 Dec 2008 |
| Total Posts: 155 |
|
|
| 28 Aug 2013 03:36 PM |
| I was wondering if it was possible to change a value within a different script. so say you have two scripts (labeled A and B), A a value named ONCE. The ONCE value is set to 10; script B completed its function and wants to change the ONCE value is in script A to 15. Is there a way to do this? i know i could use an intvalue but it would just be easier and less cluttered if this is possible. |
|
|
| Report Abuse |
|
|
Stefan631
|
  |
| Joined: 23 Dec 2010 |
| Total Posts: 1350 |
|
| |
|
|
| 28 Aug 2013 03:46 PM |
global functions only work between same types of scripts (server vs client)
first script: ONCE = 10 function _G.changeONCE(val) ONCE = val end
second script: _G.changeONCE(15) |
|
|
| Report Abuse |
|
|
Ekkoh
|
  |
| Joined: 22 Oct 2012 |
| Total Posts: 524 |
|
|
| 28 Aug 2013 04:03 PM |
Or more simply...
-- Script 1 _G.ONCE = 10
-- Script 2 print(_G.ONCE) > 10 _G.ONCE = 20 print(_G.ONCE) > 20
"To sing when you live and to sing when you die" - George Ragan |
|
|
| Report Abuse |
|
|
15cups
|
  |
| Joined: 22 Dec 2008 |
| Total Posts: 155 |
|
|
| 29 Aug 2013 03:08 PM |
| just to make things clear, the _G makes it a global value for all scripts to use? |
|
|
| Report Abuse |
|
|
| |
|
| |
|