using a variable for the name of a custom property - safe?

Josh Mellicker josh at dvcreators.net
Thu Nov 8 18:17:57 EST 2007


I have a number of custom properties to deal with, and would rather  
do this in a loop.

So, on a lark, I tried this:

on mouseUp
     set the uFavColor of me to "blue"
     set the tProperty of me to "red"
     put "uFavColor" into tProperty

     answer the tProperty of me
end mouseUp


Obviously the caveat of using the same name for a variable and custom  
property is well advised! Since the Rev parser obviously first checks  
for the value of the variable before the custom property.

My question, though, to save me a lot of lines of code, is:

Does anyone do this routinely? (Refer to a custom property with a  
variable name) Is this unsafe? Or something that might change in 2.9  
or 3?

I don't want to depend on a technique that is more trickery than  
solid programming.


(The reason I'm doing this is that I have a lot of custom properties  
that contain binary file data with sequential names and want to spit  
them all out into files in a simple loop and not manually by naming  
each explicitly- perhaps there is a simpler way?)


More information about the use-livecode mailing list