allVariables – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(Made my response actually coherent.)
(Added a comment)
Line 9: Line 9:
I guess I don't understand how the different namespaces work either. Would this command return ["_myVariable"] in both cases? - [[User:DreadedEntity|DreadedEntity]] ([[User talk:DreadedEntity|talk]]) 20:50, 12 December 2014 (CET)
I guess I don't understand how the different namespaces work either. Would this command return ["_myVariable"] in both cases? - [[User:DreadedEntity|DreadedEntity]] ([[User talk:DreadedEntity|talk]]) 20:50, 12 December 2014 (CET)
:Let's assume that you're using global variables (since I'm not sure if local variables are actually in any namespace). [[setVariable]] is simply a handy means of setting a variable, so it would return the variables in your first and second example as well as if you had used <code>missionNamespace setVariable ["myVariable",0]</code>. --[[User:SilentSpike|SilentSpike]] ([[User talk:SilentSpike|talk]]) 21:20, 12 December 2014 (CET)
:Let's assume that you're using global variables (since I'm not sure if local variables are actually in any namespace). [[setVariable]] is simply a handy means of setting a variable, so it would return the variables in your first and second example as well as if you had used <code>missionNamespace setVariable ["myVariable",0]</code>. --[[User:SilentSpike|SilentSpike]] ([[User talk:SilentSpike|talk]]) 21:20, 12 December 2014 (CET)
::Creating a global variable automatically sets it into the missionNamespace:
::<code><nowiki>someVar = "Hello, world";
hintSilent format ["%1", missionNamespace getVariable "someVar"];</nowiki></code>
::So there's no need for that. --[[User:Heeeere's Johnny!|Johnny]]

Revision as of 21:06, 13 December 2014

I don't really play around on the dev build so I'm a little confused with this command. Does it return all variables or only the ones created with setVariable? for example: _myVariable = 0; //same as with missionNamespace do { _myVariable = 0; }; I guess I don't understand how the different namespaces work either. Would this command return ["_myVariable"] in both cases? - DreadedEntity (talk) 20:50, 12 December 2014 (CET)

Let's assume that you're using global variables (since I'm not sure if local variables are actually in any namespace). setVariable is simply a handy means of setting a variable, so it would return the variables in your first and second example as well as if you had used missionNamespace setVariable ["myVariable",0]. --SilentSpike (talk) 21:20, 12 December 2014 (CET)
Creating a global variable automatically sets it into the missionNamespace:
someVar = "Hello, world"; hintSilent format ["%1", missionNamespace getVariable "someVar"];
So there's no need for that. --Johnny