kopia lustrzana https://github.com/backface/turtlestitch
1 wiersz
2.2 KiB
XML
1 wiersz
2.2 KiB
XML
<blocks app="Snap! 4.2, http://snap.berkeley.edu" version="1"><block-definition s="global variables %'names'" type="command" category="variables"><header></header><code></code><translations></translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doForEach"><l>each item</l><block var="names"/><script><block s="doRun"><block s="reportJSFunction"><list><l>name</l></list><l>if ((typeof name) != "string") {
 throw new Error("name isn't a string: " + name);
}
if (name != "") this.addVariable(name, true);</l></block><list><block var="each item"/></list></block></script></block><block s="doRun"><block s="reportJSFunction"><list></list><l>var ide = this.parentThatIsA(IDE_Morph);
ide.flushBlocksCache('variables'); // b/c of inheritance
ide.refreshPalette();</l></block><list></list></block></script></block-definition><block-definition s="sprite-local variables %'names'" type="command" category="variables"><header></header><code></code><translations></translations><inputs><input type="%mult%txt"></input></inputs><script><block s="doForEach"><l>each item</l><block var="names"/><script><block s="doRun"><block s="reportJSFunction"><list><l>name</l></list><l>if ((typeof name) != "string") {
 throw new Error("name isn't a string: " + name);
}
if (name != "") this.addVariable(name, false);</l></block><list><block var="each item"/></list></block></script></block><block s="doRun"><block s="reportJSFunction"><list></list><l>var ide = this.parentThatIsA(IDE_Morph);
ide.flushBlocksCache('variables'); // b/c of inheritance
ide.refreshPalette();</l></block><list></list></block></script></block-definition><block-definition s="does variable %'var' exist?" type="predicate" category="variables"><header></header><code></code><translations></translations><inputs><input type="%s"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>varname</l></list><l>if ((typeof varname) != "string") {
 throw new Error("name isn't a string: " + varname);
}
return this.isVariableNameInUse(varname, true);</l></block><list><block var="var"/></list></block></block></script></block-definition></blocks> |