deltaluca / nape

Haxe/AS3 Physics Engine
http://napephys.com
Other
542 stars 77 forks source link

Nape fails to run on Node.js. Also seeing issues in browser javascript. #67

Closed dionjwa closed 10 years ago

dionjwa commented 10 years ago

Is javascript a supported target for nape? I assumed so but:

A minimal example of building and running the JS target produces this output:

Create nape.space.Space
/Users/dion/storage/projects/nape_test/Test.js:1614
                ret += ":" + this.zpp_inner.int1.outer_i.toString() + "/" + this.zpp_inner.i
                                            ^
TypeError: Cannot read property 'outer_i' of null

Example:

class Test
{
    public static function main ()
    {
        trace("Create nape.space.Space");
        var space = new nape.space.Space(nape.geom.Vec2.weak(0, 0));
        trace("nape.space.Space:" + space);
    }
}

Build .hxml:

-debug
-lib nape
-cp src
-main Test
-js Test.js

Versions:

nape:  [2.0.12]
Haxe Compiler 3.1.0
dionjwa commented 10 years ago

Ok, it was my mistake. It runs fine actually, but it's just that space.toString() function blows up.

deltaluca commented 10 years ago

Blows up.... that doesn't sound too good :P The Space type doesn't even 'have' a toString!

dionjwa commented 10 years ago

I had a infinite recursion actually so the error was bogus.