Personal tools
You are here: Home documentation FAQ for Pd How do I make a local variable?
Document Actions

How do I make a local variable?

Up to Table of Contents

All variable names in Pd are global. There is only one name space for all patches.

The way to hack around this is to use $0 in variable names. For example, $0-foo.

$0 expands to a unique number for each abstraction - but not for each subpatch!

If you need to share a variable name between two abstractions, but no others, you could pass a "group identifier" into each of those abstractions and then use $n in variable names where n is the argument number of the group identifier. For example, "$1-foo". Variable names with $n in them work well with send and receive, but it is difficult (if not impossible) to get them into qlists.

This solution is discussed in the documentation.

by IOhannes m zmoelnig last modified 2008-09-14 11:39 PM

Powered by IEM Powered by Plone Section 508 WCAG Valid XHTML Valid CSS Usable in any browser