Skip to content

Instantly share code, notes, and snippets.

@bitinn
Created August 23, 2017 06:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bitinn/b2e32975e2b39a08d58c4d5758d22e94 to your computer and use it in GitHub Desktop.
Save bitinn/b2e32975e2b39a08d58c4d5758d22e94 to your computer and use it in GitHub Desktop.
TestScriptNoLocalVar.mel
// REMEMBER TO SOURCE THIS, NOT RUN IN THE SCRIPT EDITOR DIRECTLY
{
proc string GetTestString () {
return "TEST_STRING_#";
}
proc RunLocal1 () {
print(GetTestString());
}
proc RunLocal2 (string $Input) {
print($Input);
}
proc RunLocal3 () {
RunLocal2(GetTestString());
}
global proc RunGlobal () {
// works
print (GetTestString());
// works
RunLocal1();
// works
RunLocal2(GetTestString());
// works
RunLocal3();
}
global proc CreateWindow () {
if (`window -exists "TestWindow"`) {
deleteUI "TestWindow";
}
window
-title "Test"
-sizeable 0
-maximizeButton 0
-widthHeight 200 100
"TestWindow";
string $TestButtons = `frameLayout
-collapsable 0
-labelVisible 0
"TestButtons"`;
rowColumnLayout -numberOfRows 1;
button
-label "Quick Test"
-command "RunGlobal";
showWindow "TestWindow";
}
CreateWindow();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment