Extend function calling API for natives and allow catching exceptions.

Change sourcepawn url.
This commit is contained in:
BotoX
2019-09-21 21:12:29 +02:00
committed by BotoX
parent 82628cfc5a
commit da1cd9eb11
7 changed files with 491 additions and 3 deletions
+25 -1
View File
@@ -221,10 +221,20 @@ native void Call_StartForward(Handle fwd);
* @param plugin Handle of the plugin that contains the function.
* Pass INVALID_HANDLE to specify the calling plugin.
* @param func Function to call.
* @error Invalid or corrupt plugin handle, invalid function, or called before another call has completed.
*/
native void Call_StartFunction(Handle plugin, Function func);
/**
* Starts a call to a native.
*
* @note Cannot be used during an incomplete call.
*
* @param name Name of the native.
* @return True on success, false otherwise.
* @error Invalid function, or called before another call has completed.
*/
native bool Call_StartNative(const char[] name);
/**
* Pushes a cell onto the current call.
*
@@ -348,6 +358,20 @@ native void Call_PushNullString();
*/
native int Call_Finish(any &result=0);
/**
* Completes a call to a function or forward's call list.
* Catches exceptions thrown by the native.
*
* @note Cannot be used before a call has been started.
*
* @param result Return value of function or forward's call list.
* @param exception Buffer to store the exception in.
* @param maxlength Maximum length of the buffer.
* @return SP_ERROR_NONE on success, any other integer on failure.
* @error Called before a call has been started.
*/
native int Call_FinishEx(any &result=0, char[] exception, int maxlength);
/**
* Cancels a call to a function or forward's call list.
*