[Qt-interest] How to call an external script?
Dave Ceddia
dceddia at gmail.com
Mon Dec 7 19:57:35 CET 2009
Hello,
I'm using QtScript in my application, and I'd like the ability to
call/load/execute another script from within my scripts, with something
like:
callScript("external.js")
It seems like there's no built-in functionality for this. I tried making a
function to do it, using pushContext() and popContext(), but my callScript()
function ends up working more like an include() function, since modifying
variables in the external script that have the same names as globals in the
parent script results in modifying the original global variables. Ideally, I
this would work by copying the current scope/context, running the external
script in this context, and then restoring the old one. That's what I
thought pushContext() and popContext() should do, but no luck there.
However, at the point where I try to do all this, I'm already "inside" a
pushContext() in a QScriptEngine that is already evaluating a script. Maybe
that's the culprit? And if so, how do I work around it?
Thanks,
Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091207/555676eb/attachment.html
More information about the Qt-interest-old
mailing list