-- set global variable
sky.setVar("varName", varValue);
-- get global variable
myNewVar = sky.getVar("varName");
For more information, look in the Lua API "Sky" library
sky.setVar("intVar", 10);
number = sky.getVar("intVar");
sky.lprint(number);
The next release could be in the next week.
SolarPortal wrote:To set and get global variables, use:
- Code: Select all
-- set global variable
sky.setVar("varName", varValue);
-- get global variable
myNewVar = sky.getVar("varName");
These exist in the engine and are accessible from any script.
Hope this helps.
For more information, look in the Lua API "Sky" library.
tonumber(strReturnVal);
StarFire wrote:When I get a chance I will set up a quick test, I am sure its working, or should be
function onInit(objID)
val = 123;
sky.setVar("test",val);
result = sky.getVar("test");
sky.print("Scene Result = "..result)
end
function onInit(objID)
val = 123;
sky.setVar("test",val);
end
function onInit(objID)
result = sky.getVar("test");
sky.print("MS Result = "..result)
end
let me know if this works for you.
function onInit(objID)
result = sky.getVar("test");
sky.print("MS Result = "..result)
if (result == 123) then
sky.print("MS Really Does = "..result)
end
end
function onInit(objID)
val = 123;
sky.setVar("test",val);
end
function postInit(objID)
result = sky.getVar("test");
sky.print("MS Result = "..result)
if (result == tostring(123)) then
sky.print("MS Really Does = "..result)
end
end
CreativeOcclusion wrote:Thank you so much for your help...This works perfectly... :D :D :D
I have been fighting with this for four days now...So close yet so far away...Now thanks to you it works...I can do a lot more now that I can pass the variables between scripts :idea: ....Thanks
But it's lonely out here in the wild west
(in the distance, at tumbleweed rolls silently by)
Users browsing this forum: No registered users and 44 guests