From 2a46f8f881c18800952f93a1e2792bbce982e7d2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 23 Jul 2014 23:36:11 -0700 Subject: [PATCH] Add GetNativeFunction (bug 6200). --- core/logic/smn_fakenatives.cpp | 1 + plugins/include/functions.inc | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/core/logic/smn_fakenatives.cpp b/core/logic/smn_fakenatives.cpp index 3c084bff..f5f9d66a 100644 --- a/core/logic/smn_fakenatives.cpp +++ b/core/logic/smn_fakenatives.cpp @@ -441,6 +441,7 @@ REGISTER_NATIVES(nativeNatives) {"GetNativeArray", GetNativeArray}, {"GetNativeCell", GetNativeCell}, {"GetNativeCellRef", GetNativeCellRef}, + {"GetNativeFunction", GetNativeCell}, {"GetNativeString", GetNativeString}, {"GetNativeStringLength", GetNativeStringLength}, {"FormatNativeString", FormatNativeString}, diff --git a/plugins/include/functions.inc b/plugins/include/functions.inc index dc6f31d1..e928213b 100644 --- a/plugins/include/functions.inc +++ b/plugins/include/functions.inc @@ -428,6 +428,15 @@ native SetNativeString(param, const String:source[], maxlength, bool:utf8=true, */ native any:GetNativeCell(param); +/** + * Gets a function pointer from a native parameter. + * + * @param param Parameter number, starting from 1. + * @return Function pointer at the given parameter number. + * @error Invalid parameter number, or calling from a non-native function. + */ +native Function GetNativeFunction(param); + /** * Gets a cell from a native parameter, by reference. *