JavaScript doesn't give you access to the current scope (where local vars are stored). The only way to programatecilly create entries in it is to use eval.
My suggestion is think of another API that's more JS friendly. There is a reason node dropped import syntax and now only supports require where you have to store the return value somewhere. On Wed, Aug 1, 2012 at 7:31 AM, Seiji Sam Lee <[email protected]> wrote: > For Tim & Dominic: > > Well the complete code is ... > > <?node.js > > var common=$script.imports("common.jsi",true); > > var width =750; > var height=300; > > .... > > ?> > > > As you can see this is a piece of javascript embedded into other language > (asp, php like). > I built a whirler to convert this to JS and ... execute it into a VM > (runIn{This,New}Context) > > You can see too $script.imports(...) loads a JS include (*.jsi) and execute > it into OTHER VM, and that was my question... > > I have this syntax: > > var common=$script.imports("common.jsi",true); > > because I dont know how achieve common.jsi create variables into the context > that call it, so now the only way to perform that is returns an object (var > common). > > I would like this syntax: > > $script.imports("common.jsi",true); > > and that this call (remember VM) creates variables in this (no literal) > context. >> >> > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
