associative arrays

Robert Brenstein rjb at rz.uni-potsdam.de
Fri Dec 13 04:58:00 EST 2002


I seem to have a problem passing associative arrays as argument in 
certain situation.

It works if an array is asigned to global -- I can use it as 
associative array in any handler.

global myArray
get myArray[key]

It works if I pass it as argument of a directly called handler or function

get getKeyValue(myArray,key)

function getKeyValue myArray
return myArray[key]
end getKeyValue

However, I need to pass it as an argument to a function that is 
dynamically defined and executed through do.

put webArg into fName -- let's say webArg = somfunction

do "get" && fName & "(" & myArray & ")"

function somfunction myArray
return myArray[key]
end somfunction

In somfunction, the associative array give empty values for key and 
array elements.

I tried putting the array in quote, which often helps in such a 
situation, but no dice, the same problem.

do "get" && fName & "(" & quote & myArray & quote & ")"

I get the same problem with dynamically defined handlers, so no 
rescue in that path.

Is it me, is it a bug, or is it simply not possible?

Robert Brenstein



More information about the metacard mailing list