Raised This Month: $ Target: $400
 0% 

private forwards methodmap constructor error?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nergal
Veteran Member
Join Date: Apr 2012
Old 12-29-2015 , 13:33   private forwards methodmap constructor error?
Reply With Quote #1

so I made a methodmap on private forwards (for my own personal use) and it keeps giving me an error on the constructor.

PHP Code:
methodmap PrivForws Handle
{
    public 
PrivForwsExecType etypeParamType ... )
    {
        
Handle forw CreateForward(etype, ...); //<- error line @ here.
        
if (forw)
            return 
view_as<PrivForws>( forw );
        return 
null;
    }
    public 
int GetFuncCount()
    {
        return 
GetForwardFunctionCount(this);
    }
    public 
bool Add(Handle plugin, Function func)
    {
        return 
AddToForward(thispluginfunc);
    }
    public 
bool Remove(Handle plugin, Function func)
    {
        return 
RemoveFromForward(thispluginfunc);
    }
    public 
int RemoveAll(Handle plugin)
    {
        return 
RemoveAllFromForward(thisplugin);
    }
    public 
void Start()
    {
        
Call_StartForward(this);
    }
}; 
The error is "error 029: invalid expression, assumed zero" @ the "Handle forw = CreateForward(etype, ...);" type.

What's wrong with it?
__________________

Last edited by nergal; 12-29-2015 at 13:34.
nergal is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-29-2015 , 13:38   Re: private forwards methodmap constructor error?
Reply With Quote #2

SP has no way of interacting with varargs, your use of ... in the function call makes no sense.
__________________
asherkin is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 12-29-2015 , 14:12   Re: private forwards methodmap constructor error?
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
SP has no way of interacting with varargs, your use of ... in the function call makes no sense.
I see, I've replaced the two params with a Handle param then, thanks Ash.
__________________
nergal is offline
psychonic

BAFFLED
Join Date: May 2008
Old 12-29-2015 , 14:20   Re: private forwards methodmap constructor error?
Reply With Quote #4

Purely personal preference, but I think that the function count would make more sense implemented as a Property.
psychonic is offline
nergal
Veteran Member
Join Date: Apr 2012
Old 12-29-2015 , 19:11   Re: private forwards methodmap constructor error?
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
Purely personal preference, but I think that the function count would make more sense implemented as a Property.
yes you're right, I forgot the object-oriented rule: actions are methods, attributes are data
__________________
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 14:02.


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