var Event = function(x,y) { this.x = x; this.y = y; };
var obj = new Event(e.x, e.y);return Sk.ffi.remapToPy(obj);
print(inst.x)
print(inst['x'])
Sk.externalLibraries = {
numpy : {
path: 'http://example.com/static/primeronoo/skulpt/external/numpy/__init__.js',
dependencies: ['/static/primeronoo/skulpt/external/deps/math.js'],
}
};
var $builtinmodule = function(name)
{
var mod = {};
var myalert = function(s) {
alert(s);
}
mod.alert = new Sk.builtin.func(function(a) {
return myalert(a.v);
});
mod.Actor = Sk.misceval.buildClass(mod, function($gbl, $loc) {
$loc.__init__ = new Sk.builtin.func(function(self) {
self.x = 0;
});
$loc.__getattr__ = new Sk.builtin.func(function (self, name) {
if (name != null && (Sk.builtin.checkString(name) || typeof name === "string")) {
var _name = name;
if (Sk.builtin.checkString(name)) {
_name = Sk.ffi.remapToJs(name);
}
switch (_name) {
case 'x':
return self.x;
}
}
});
$loc.__setattr__ = new Sk.builtin.func(function (self, name, value) {
if (name != null && (Sk.builtin.checkString(name) || typeof name === "string")) {
var _name = name;
if (Sk.builtin.checkString(name)) {
_name = Sk.ffi.remapToJs(name);
}
switch (_name) {
case 'x':
self.x = value;
return;
}
}
});
$loc.getx = new Sk.builtin.func(function(self) {
return self.x;
});
},
'Actor', []);
return mod;
Thank you very much. Is it possible to create instance of this class directly in Javascript?