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

Return a Function


Post New Thread Reply   
 
Thread Tools Display Modes
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 01-11-2020 , 10:58   Re: Return a Function
Reply With Quote #11

That's why i would prefer to just return a Function pointer directly (instead of storing all these handles) but i think i need to rewrite ItemBehavior code to use forwards.
__________________
MAGNAT2645 is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 01-11-2020 , 11:28   Re: Return a Function
Reply With Quote #12

Well Call_StartFunction requires a plugin handle and a Function pointer anyway, so you would need to return both things. And I imagine the point of RegItemBehavior is to store these things, so it's cleaner to use forwards or Call_StartFunction in the same plugin to call them.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 01-11-2020 , 11:38   Re: Return a Function
Reply With Quote #13

But there would be no difference in storing values.
Now i have this (just removed FuncUnequip because moved it to FuncEquip as boolean):

Code:
enum struct ItemBehavior {
	char Token[ MAX_ITEM_TOKEN_LENGTH ];
	Handle Owner;
	PrivateForward FuncUse;
	PrivateForward FuncEquip;
	PrivateForward FuncTrade;
	PrivateForward FuncSell;
	PrivateForward FuncDrop;
}
Just replaced Function with PrivateForward.
__________________
MAGNAT2645 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 11:05.


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