Raised This Month: $51 Target: $400
 12% 

[PAWN] WritePackFunction?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 01-17-2015 , 20:08   [PAWN] WritePackFunction?
Reply With Quote #1

I noticed in datapack.inc that there's a "WritePackFunction" native but the param says "@param fktptr Function pointer to add."

So how would one go about making a function pointer for the datapack?
__________________
nergal is offline
Starbish
AlliedModders Donor
Join Date: Oct 2011
Location: South Korea
Old 01-18-2015 , 09:36   Re: [PAWN] WritePackFunction?
Reply With Quote #2

Quote:
Originally Posted by nergal View Post
I noticed in datapack.inc that there's a "WritePackFunction" native but the param says "@param fktptr Function pointer to add."

So how would one go about making a function pointer for the datapack?

/**
* 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 void WritePackFunction(Handle pack, Function fktptr)

Function variable type is just an index like handle.

you can get it by using like GetFunctionByName().

umm... but that's just for SM 1.7 not an SM 1.6.

i'm not sure 'Function Variable Type' is the same as 1.6 did.
__________________

Last edited by Starbish; 01-18-2015 at 09:36.
Starbish is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-18-2015 , 09:48   Re: [PAWN] WritePackFunction?
Reply With Quote #3

It's just for legacy support, as you can no longer write a function into a pack using WritePackCell (as they no longer coerce to an integer). It's exactly the same as passing the callback to i.e. HookEvent.
__________________
asherkin is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 03-31-2015 , 09:37   Re: [PAWN] WritePackFunction?
Reply With Quote #4

I'm a dunce, I don't understand the use case for this. Would I write a function in the .sp and then call that function in the timer using ReadPackFunction?
__________________
View my Plugins | Donate
TnTSCS is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 03-31-2015 , 16:11   Re: [PAWN] WritePackFunction?
Reply With Quote #5

Quote:
Originally Posted by TnTSCS View Post
I'm a dunce, I don't understand the use case for this. Would I write a function in the .sp and then call that function in the timer using ReadPackFunction?
no, it basically stores the function for whatever you need to use it for and you have to call it with call_startfunction.
__________________
nergal is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode