Esempio n. 1
0
void CScriptEngine::process_file_if_exists(LPCSTR file_name, bool warn_if_not_exist)
{
    u32						string_length = xr_strlen(file_name);
    if (!warn_if_not_exist && no_file_exists(file_name, string_length))
        return;

    string_path				S, S1;
    if (m_reload_modules || (*file_name && !namespace_loaded(file_name)))
    {
        FS.update_path(S, "$game_scripts$", strconcat(sizeof(S1), S1, file_name, ".script"));
        if (!warn_if_not_exist && !FS.exist(S))
        {
#ifdef DEBUG
#	ifndef XRSE_FACTORY_EXPORTS
            if (psAI_Flags.test(aiNilObjectAccess))
#	endif
            {
                print_stack			();
                Msg					("* trying to access variable %s, which doesn't exist, or to load script %s, which doesn't exist too",file_name,S1);
                m_stack_is_ready	= true;
            }
#endif
            add_no_file(file_name, string_length);
            return;
        }
        //#ifndef MASTER_GOLD
        if (strstr(Core.Params, "-dbg"))
            Msg("* loading script %s", S1);
        //#endif // MASTER_GOLD
        m_reload_modules = false;
        load_file_into_namespace(S, *file_name ? file_name : "_G");
    }
}
Esempio n. 2
0
bool CScriptStorage::object	(LPCSTR namespace_name, LPCSTR identifier, int type)
{
	int						start = lua_gettop(lua());
	if (xr_strlen(namespace_name) && !namespace_loaded(namespace_name,false)) {
		VERIFY				(lua_gettop(lua()) == start);
		return				(false); 
	}
	bool					result = object(identifier,type);
	VERIFY					(lua_gettop(lua()) == start);
	return					(result); 
}