Strange hang

Mike Bonner bonnmike at gmail.com
Tue Jan 15 09:45:21 EST 2013


Why not put all your scripts that deal with your array into a library stack
(or card or whatever) declare it as a local, then.. while its not as fast,
you can pass a full string in and "do" it.

get deleteVar("tDataA[key1]

function deleteVar pString
do merge("delete local [[passedstring]]")
end deleteVar

For multiples at once it would be easy enough to pass in a list of lines
and repeat for each, and using do would make it easy to pass in strings
with subkeys if you don't want to remove the entire node.
deletevar(merge("tDataA[key1][subkey1][anotherkey]") )

While do isn't as fast as other options, it might work for what you need.
Of course if you're only truncating full nodes, keeping all the functions
in the same script with the array as local makes that work too. Just pass
in the keyname and whack the node.



On Tue, Jan 15, 2013 at 7:34 AM, Peter M. Brigham <pmbrig at gmail.com> wrote:

> I believe that all you have to do is put the array element into a variable
> first before passing it to the command or function:
>
> on mouseUp
>   put 4 into aArray[1]
>   put aArray[1] into msg
>   put aArray[1] into tElement -- the important step
>   put fAddNum(tElement) into tBobTest
>   put cr & tBobTest after msg
> end mouseUp
>
> -- Peter
>
> Peter M. Brigham
> pmbrig at gmail.com
> http://home.comcast.net/~pmbrig
>
> On Jan 15, 2013, at 1:01 AM, Kay C Lan wrote:
>
> > On Tue, Jan 15, 2013 at 12:44 PM, Robert Sneidar <slylabs13 at me.com>
> wrote:
> >> Yeah I misunderstood. The only thing you cannot do (and there is/was a
> request to implement this) is to pass an element of an array as a parameter
> to a command or function eg. put myFunction(myArray[1]) into bobtest.
> >>
> >> Bob
> >
> > Bob,
> >
> > Your scaring me! This is essential in my current project, I've
> > basically shotgunned my scripts with such, so if you're telling me
> > it's going to break at some stage, I'm going to cry.
> >
> > 1) New Main Stack
> > 2) Add button
> > 3) Copy and Paste this script into the button's script:
> >
> > on mouseUp
> >   put 4 into aArray[1]
> >   put aArray[1] into msg
> >   put fAddNum(aArray[1]) into tBobTest
> >   put cr & tBobTest after msg
> > end mouseUp
> >
> >
> > FUNCTION fAddNum pNum
> >   add 10 to pNum
> >   return pNum
> > end fAddNum
> >
> > Please tell me I've misunderstood and it's something else that can't be
> done.
> >
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the Use-livecode mailing list