set
API - sets global variables to the main coroutine.
function test()
wait(3);
local myValue = get('testValue'); --gets the global object/variable testValue from the main script
log(myValue); --prints 10
myValue = myValue + 15; --adds 15 to the local variable
set('testValue', myValue) --sets the main script variable to the local variable here. **25**
end
return function()
testValue = 10;
local coroutineId = async('test');
waitForCoroutine(coroutineId);
--while waiting the async coroutine is playing it will print
--10
log(testValue); --prints 25
log('finished');
end
Last updated