Exemple #1
0
void CScriptEngine::init				()
{
	CScriptStorage::reinit				();

	luabind::open						(lua());
	setup_callbacks						();
	export_classes						(lua());
	setup_auto_load						();

#ifdef DEBUG
	m_stack_is_ready					= true;
#endif

#ifdef DEBUG
#	ifdef USE_DEBUGGER
		if( !debugger() || !debugger()->Active()  )
#	endif
			lua_sethook					(lua(),lua_hook_call,	LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET,	0);
#endif

	bool								save = m_reload_modules;
	m_reload_modules					= true;
	process_file_if_exists				("_G",false);
	m_reload_modules					= save;

	register_script_classes				();
	object_factory().register_script	();

#ifdef XRGAME_EXPORTS
	load_common_scripts					();
#endif
	m_stack_level						= lua_gettop(lua());
}
Exemple #2
0
void CScriptEngine::init()
{
#ifdef USE_LUA_STUDIO
    bool lua_studio_connected = !!m_lua_studio_world;
    if (lua_studio_connected)
        m_lua_studio_world->remove		(lua());
#endif // #ifdef USE_LUA_STUDIO

    CScriptStorage::reinit();

#ifdef USE_LUA_STUDIO
    if (m_lua_studio_world || strstr(Core.Params, "-lua_studio")) {
        if (!lua_studio_connected)
            try_connect_to_debugger		();
        else {
#ifdef USE_LUAJIT_ONE
            jit_command					(lua(), "debug=2");
            jit_command					(lua(), "off");
#else
            luaJIT_setmode(lua(), 0, LUAJIT_MODE_ENGINE | LUAJIT_MODE_OFF);
#endif
            m_lua_studio_world->add		(lua());
        }
    }
#endif // #ifdef USE_LUA_STUDIO

    luabind::open(lua());
    setup_callbacks();
    export_classes(lua());
    setup_auto_load();

#ifdef DEBUG
    m_stack_is_ready					= true;
#endif

#ifndef USE_LUA_STUDIO
#	ifdef DEBUG
#		if defined(USE_DEBUGGER) && !defined(USE_LUA_STUDIO)
    if( !debugger() || !debugger()->Active()  )
#		endif // #if defined(USE_DEBUGGER) && !defined(USE_LUA_STUDIO)
        lua_sethook					(lua(),lua_hook_call,	LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET,	0);
#	endif // #ifdef DEBUG
#endif // #ifndef USE_LUA_STUDIO
    //	lua_sethook							(lua(), lua_hook_call,	LUA_MASKLINE|LUA_MASKCALL|LUA_MASKRET,	0);

    bool								save = m_reload_modules;
    m_reload_modules = true;
    process_file_if_exists("_G", false);
    m_reload_modules = save;

    register_script_classes();
    object_factory().register_script();

#ifdef XRGAME_EXPORTS
    load_common_scripts();
#endif
    m_stack_level = lua_gettop(lua());
}