On 2013-03-23 12:15:49, Konstantin Tcholokachvili wrote:
> -------------------------------------------------------------------------
> var proto = $new(null);
> proto.foo = function() { $print(this.msg) }
> -------------------------------------------------------------------------You just create some local variable here and don't export anything. As documented on http://nekovm.org/doc/vm, loadmodule returns module's $export variable. So to make it work, simply change your proto.neko to: ------------------------------------------------------------------------- $exports.foo = function() { $print(this.msg) } ------------------------------------------------------------------------- With this change, your lod.neko > ------------------------------------------------------------------------- > var proto = $loader.loadmodule("proto",$loader); > > var o = $new(null); > o.msg = "hello"; > $objsetproto(o,proto); > o.foo(); // print "hello" > ------------------------------------------------------------------------- Will print "hello" as you expect. K. -- Neko : One VM to run them all (http://nekovm.org)
