cocos2d/cocos2d-x — pull request #2017 by nicolasgramlich (2013-02-21 03:25:02+00:00)
Title: Added cleanup() and reset() functionality to ScriptingCore. Also added functionality to set an externalScriptPath.

The methods ``cleanup()`` and ``reset()`` are necessary i.e. when a game is not just a single screen (i.e. an Android Activity), but a screen is destroyed and recreated, there should be a way to reset the ``ScriptingCore``. On Android the GLThread changes when the Activity i.e. is destroyed and recreated. Touching the ``ScriptingCore`` causes a guaranteed crash. -> When the 'screen' is destroyed the caller has to ensure that the ``cleanup()`` is called from the same Thread. This change was developed with @funkaster and @folecr.

The ``externalScriptPath`` is very useful i.e. when debugging on the iOS simulator, one can redirect the path the scripts are loaded from to the host machine (On Android i.e. to the SD-Card), allowing to change the JS files without recompilation and even without restarting the app.

Also removed a good bunch of trailing whitespaces.