Added framework functionality & work on lua_script_debugger.

framework now saves the module's instance.
framework re-connects to writeBindings before it issues the
onTemplateLoaded function so that the bindings don't need to be
established in that function.