Code: Select all
local p1, p2, p3 -- 3 arrays
--
repeat with index = 1 to 3
put index into < something to eval p + index? >[ "key1" ]
end repeat
TIA,
Kai
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
local p1, p2, p3 -- 3 arrays
--
repeat with index = 1 to 3
put index into < something to eval p + index? >[ "key1" ]
end repeat
Code: Select all
repeat with index = 1 to 3
put <whatever its is you want to stash in the array> into tmp
put ( "put tmp into g" & index & "[" & quote & "<key goes here>" & quote & "]" ) into code
do code
end repeat
Kai, I don't think this is a bug, it's just the way that you deal indirectly with variables in Revolution.kpeters wrote:No wonder I was confused - apparently there's a bug (since 2.5.xx) in Revolution that makes things a bit harder - but this works:
KaiCode: Select all
repeat with index = 1 to 3 put <whatever its is you want to stash in the array> into tmp put ( "put tmp into g" & index & "[" & quote & "<key goes here>" & quote & "]" ) into code do code end repeat
Code: Select all
do "put tmp into g" & index & "[" & quote & "<key goes here>" & quote & "]"
Code: Select all
local theArray
repeat with index = 1 to 3
put <whatever> into theArray[n,"someKey"]
end repeat
That can be writen better using format():Mark Smith wrote:Code: Select all
do "put tmp into g" & index & "[" & quote & "<key goes here>" & quote & "]"
Code: Select all
do format("put tmp into g%s["key"]",index)
Code: Select all
do merge("put tmp into g[[index]][key]")
Code: Select all
on mouseUp
put empty -- clear msg box
put "Test" into myVar
-- store
repeat with index = 1 to 3
put "cProp" & myVar & "[" & index & "]" into myVarName
set the myVarName of me to random(10)
end repeat
-- display in msg box
repeat with index = 1 to 3
put "cProp" & myVar & "[" & index & "]" into myVarName
put the myVarName of me & cr after msg
end repeat
end mouseUp
Kai, this turned out to be a documentation bug...it's actually always been necessary to use do/merge to do what you've described.kpeters wrote:Thanks guys -
as a newbie I do appreciate your suggestions on code improvement!
Mark - as for the suspected bug look here:
http://article.gmane.org/gmane.comp.ide ... ser/56411/
match=eval
Kai