core/smn_keyvalues.cpp
changeset 750 97ee8167485f
parent 743 a2804c2faba2
child 751 a55c2d4bebe4
     1.1 --- a/core/smn_keyvalues.cpp	Sun May 06 23:35:45 2007 +0000
     1.2 +++ b/core/smn_keyvalues.cpp	Mon May 07 00:02:33 2007 +0000
     1.3 @@ -637,6 +637,25 @@
     1.4  	return 1;
     1.5  }
     1.6  
     1.7 +static cell_t smn_KvNodesInStack(IPluginContext *pCtx, const cell_t *params)
     1.8 +{
     1.9 +	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.10 +	HandleError herr;
    1.11 +	HandleSecurity sec;
    1.12 +	KeyValueStack *pStk;
    1.13 +
    1.14 +	sec.pOwner = NULL;
    1.15 +	sec.pIdentity = g_pCoreIdent;
    1.16 +
    1.17 +	if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
    1.18 +		!= HandleError_None)
    1.19 +	{
    1.20 +		return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
    1.21 +	}
    1.22 +
    1.23 +	return pStk->pCurRoot.size();
    1.24 +}
    1.25 +
    1.26  static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
    1.27  {
    1.28  	Handle_t hndl = static_cast<Handle_t>(params[1]);
    1.29 @@ -731,5 +750,6 @@
    1.30  	{"KvSetEscapeSequences",	smn_KvSetEscapeSequences},
    1.31  	{"KvDeleteThis",			smn_KvDeleteThis},
    1.32  	{"KvDeleteKey",				smn_KvDeleteKey},
    1.33 +	{"KvNodesInStack",			smn_KvNodesInStack},
    1.34  	{NULL,						NULL}
    1.35  };