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

Creating callbacks in Sourcepawn


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
popey456963
Member
Join Date: Mar 2016
Old 07-01-2018 , 08:15   Creating callbacks in Sourcepawn
Reply With Quote #1

I'm trying to add a callback to a function I've designed which does some asynchronous actions. Using the example from Timers, I create a typedef:

HTML Code:
typeset ActionCallback {
  function void(float actions[2]);
}
And then I have a function attached to a methodmap which tries to call this "ActionCallback":

HTML Code:
  public void Save(ActionCallback callback) {
    int test[2];

    test[0] = 2;
    test[1] = 1;


    callback(test);
  }
Unfortunately, at the moment I'm getting a variety of errors that I have no idea how to solve. Namely:

C:\Users\\Documents\GitHub\ttt_sourcemod\rewr ite\includes\player_actions.inc(47) : error 012: invalid function call, not a valid address
C:\Users\\Documents\GitHub\ttt_sourcemod\rewr ite\includes\player_actions.inc(47) : warning 215: expression has no effect
C:\Users\\Documents\GitHub\ttt_sourcemod\rewr ite\includes\player_actions.inc(47) : error 001: expected token: ";", but found ")"
C:\Users\\Documents\GitHub\ttt_sourcemod\rewr ite\includes\player_actions.inc(47) : error 029: invalid expression, assumed zero
C:\Users\\Documents\GitHub\ttt_sourcemod\rewr ite\includes\player_actions.inc(47) : fatal error 190: too many error messages on one line

Does anyone know why my callback is not being identified as a function?
popey456963 is offline
 



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 19:53.


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