Another scripting Problem
Hi,
i need a bit of help. I scripted a mesh and now i wanted to divide the script into procedures to have a nicer overview over the script. the problem now is that i need in several procedures different Cons/Doms. I wanted to create a procedure where i define all of these parameters to get them later in the procedures. My script: Code:
# PROCEDURE TO SET UP ALL PARAMETER Code:
Script: ----- TCL TRACE ----- Thank you very much for your help :) |
Variable scope is a feature of Tcl, not Glyph. Therefore, you can find many online resources such as this one: https://www.tcl.tk/man/tcl8.5/tutorial/Tcl13.html
This page includes the ability to make variables global in scope. However, in general, global variables are bad practice. I would recommend passing variables to a proc via its parameter list instead. I hope this helps. |
To answer your question directly, the error is caused by using the array subscript in the global statement.
I did not test this, but your proc should look like: Code:
proc PARAMETER {} { Using global variables is a bad* programming practice in general. However, for "quick and dirty" scripts that will be used once and then thrown away, globals may be the easiest way to get things done quickly. * There are always exceptions to the rules! (bad != NEVER) |
All times are GMT -4. The time now is 11:00. |