core/smn_core.cpp
changeset 1124 a397d51fb986
parent 1113 c09265bc03ce
child 1231 17badaf66ce4
     1.1 --- a/core/smn_core.cpp	Sun Jul 15 22:34:30 2007 +0000
     1.2 +++ b/core/smn_core.cpp	Mon Jul 16 02:06:02 2007 +0000
     1.3 @@ -339,7 +339,8 @@
     1.4  	pContext->LocalToString(params[1], &name);
     1.5  	if (pContext->FindNativeByName(name, &idx) != SP_ERROR_NONE)
     1.6  	{
     1.7 -		return pContext->ThrowNativeError("Unable to find native \"%s\"", name);
     1.8 +		/* Oops! This HAS to silently fail! */
     1.9 +		return 0;
    1.10  	}
    1.11  
    1.12  	ctx->natives[idx].flags |= SP_NTVFLAG_OPTIONAL;
    1.13 @@ -359,6 +360,14 @@
    1.14  	return 1;
    1.15  }
    1.16  
    1.17 +static cell_t LibraryExists(IPluginContext *pContext, const cell_t *params)
    1.18 +{
    1.19 +	char *str;
    1.20 +	pContext->LocalToString(params[1], &str);
    1.21 +
    1.22 +	return g_PluginSys.LibraryExists(str) ? 1 : 0;
    1.23 +}
    1.24 +
    1.25  REGISTER_NATIVES(coreNatives)
    1.26  {
    1.27  	{"AutoExecConfig",			AutoExecConfig},
    1.28 @@ -376,5 +385,6 @@
    1.29  	{"FormatTime",				FormatTime},
    1.30  	{"MarkNativeAsOptional",	MarkNativeAsOptional},
    1.31  	{"RegPluginLibrary",		RegPluginLibrary},
    1.32 +	{"LibraryExists",			LibraryExists},
    1.33  	{NULL,						NULL},
    1.34  };