Skip to content

Instantly share code, notes, and snippets.

@kjunichi
Created October 15, 2012 00:48
Show Gist options
  • Save kjunichi/3890309 to your computer and use it in GitHub Desktop.
Save kjunichi/3890309 to your computer and use it in GitHub Desktop.
#TODO ringojs上でのjavascirptの扱いでハマっているので、素のRhino環境をMacBook Pro Retinaに構築
importPackage(Packages.org.mozilla.javascript);
var cx = Context.enter();
var scope = cx.initStandardObjects();
var s = "var o={};o.myfunc=function (x){return x+1;}; o.myfunc(7)";
var result = cx.evaluateString(scope, s, "<cmd>", 1, null);
var msg=Context.toString(result)+"]]]][[[";
var oObj = scope.get("o", scope);
TypeError: Cannot find function get in object [object Object]. (main.js#36(eval)#19) was not found on the server.

だと

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment