Just started trying to port gamekit to emscripten. Beyond other problems I struggled on swig generated lua-layer which threw a for me cryptic “trapped”-exception in the ‘SWIG_Lua_namespace_register’-function.

To make the long story short. Swig 2.0.11 created invalid code with int SWIG_Lua_namespace_register(..) function that did not return a value, which seemed to be the problem. Adding a return 1; manually at the two problematic function fixed the problem.

For a happy ending for this specific problem it was sufficient to upgrade to swig3.0.3…

UPDATE:

Actually swig3 seems to have changed its way of how inhertitance is handled, which somehow broke inheritance of methods at all!? Using the swig-switch -squash-bases let you use the old way, but this brought back the emscripten-problems :D. Ok, there seems no way around to fix it in swig itself.

Update2:

Very cool, posted a pull-request on the swig-changes and they got merged immediately :D
https://github.com/swig/swig/pull/303