Merge pull request #122 from peace-maker/datapack_funcpointer

Add WritePackFunction and ReadPackFunction natives
This commit is contained in:
David Anderson
2014-08-12 10:33:27 -07:00
5 changed files with 176 additions and 12 deletions
+19
View File
@@ -72,6 +72,16 @@ native WritePackFloat(Handle:pack, Float:val);
*/
native WritePackString(Handle:pack, const String:str[]);
/**
* Packs a function pointer into a data pack.
*
* @param pack Handle to the data pack.
* @param fktptr Function pointer to add.
* @noreturn
* @error Invalid handle.
*/
native WritePackFunction(Handle:pack, Function:fktptr);
/**
* Reads a cell from a data pack.
*
@@ -101,6 +111,15 @@ native Float:ReadPackFloat(Handle:pack);
*/
native ReadPackString(Handle:pack, String:buffer[], maxlen);
/**
* Reads a function pointer from a data pack.
*
* @param pack Handle to the data pack.
* @return Function pointer.
* @error Invalid handle, or bounds error.
*/
native Function ReadPackFunction(Handle:pack);
/**
* Resets the position in a data pack.
*