From ba55eab9f51ecd097fd25a8e0477793f5b88c07c Mon Sep 17 00:00:00 2001 From: Borja Ferrer Date: Tue, 1 Aug 2006 01:14:54 +0000 Subject: [PATCH] find native by name --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4047 --- sourcepawn/vm/sp_vm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sourcepawn/vm/sp_vm.c b/sourcepawn/vm/sp_vm.c index 2c668530..b9651fb4 100644 --- a/sourcepawn/vm/sp_vm.c +++ b/sourcepawn/vm/sp_vm.c @@ -1,4 +1,5 @@ #include +#include #include #include "sp_vm.h" @@ -105,3 +106,19 @@ int SP_HeapRelease(sp_context_t *ctx, cell_t local_addr) return SP_ERR_NONE; } + +int SP_FindNativeByName(sp_context_t *ctx, const char *name, uint32_t *index) +{ + uint32_t i; + + for (i = 0; i < ctx->plugin->info->natives_num; i++) + { + if (!strcmp(name, ctx->natives[i].name)) + { + if (index) + *index = i; + return SP_ERR_NONE; + } + } + return SP_ERR_NOT_FOUND; +} \ No newline at end of file