Hi Matthew, I don't think you really need to use the "do" statement here at all. I really don't understand what the "stackobject" variable is used for, but here's a way to do what you want to do.
Change your "on new" handler to something like this: on new me stackScriptName, stackobject, maxsize amd save stackScriptName in a property variable instead of stackType. Then in your "on addnewstackobject, do this: if stack.count < maxsizeofstack) then newStackObject = new(script stackScriptName) append(stack, newStackObject) return stack.count etc. If you are trying to create a new object and at the same time are trying to pass in a reference to this "manager" object, then you probably want to do something like this: on addnewStackObject me -- <-- don't forget the "me" variable here if stack.count < maxsizeofstack) then newStackObject = new(script stackScriptname, me) ... <same as above> Hope this helps, Irv At 2:22 PM -0500 2/25/02, Matthew DeSimone wrote: >I've run into a snag here with the modified stack manager code that Irv >proposed a few days ago. > >As follows is my script for a type agnostic object stack manager. The >problem lies in the fact that I need to say stack[somestackpoint] is >equal to a new object of type typeofstack and name objectofstack. I am >at a loss as to how to properly represent this without using do. > >For instance, lets say typeofstack = "xtra" and objectofstack = >"xmlparser", I need do to execute "new (xtra "xmlparser")". >Theoretically that is what my do cmd below is doing. However, I keep >receiving "variable not defined" errors with the question mark after the >"new(" string. Is what I'm doing legal? If not, any proposed >suggestions on how I would go about doing it correctly? > > >property stack >property typeofstack >property objectofstack >property maxsizeofstack > >on new me, stacktype, stackobject, maxsize > me.maxsizeofstack = maxsize > me.stack = [] > me.typeofstack = stacktype > me.objectofstack = stackobject > return me >end > >on addnewstackobject > if (stack.count < maxsizeofstack) then > stack.append((do "new(" & typeofstack & " " & QUOTE & >string(objectofstack) & QUOTE & ")")) return stack.count > else > if ((findrecycledstackobject()) <> void) then > return findrecycledstackobject() > end if > end if > return void >end addnewstackobject > > >on findrecycledstackobject > repeat with control = 1 to stack.count > if (stack[control] = 0) then > stack[control] = 0 > return stack[control] > end if > end repeat > return void >end findrecycledstackobject > > >~matt desimone >[EMAIL PROTECTED] >www.syrupnyc.com > > > >[To remove yourself from this list, or to change to digest mode, go >to http://www.penworks.com/lingo-l.cgi To post messages to the >list, email [EMAIL PROTECTED] (Problems, email >[EMAIL PROTECTED]). Lingo-L is for learning and helping with >programming Lingo. Thanks!] -- Lingo / Director / Shockwave development for all occasions. (Home-made Lingo cooked up fresh every day just for you.) [To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping with programming Lingo. Thanks!]