Pointers to procedure

Everything else that doesn't fall into one of the other categories.
User avatar
MrTAToad
Posts: 291
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England
Contact:

Pointers to procedure

Post by MrTAToad »

Is there any way of calling a procedure held in a variable pointer ?
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: Pointers to procedure

Post by Fred »

You can use prototype for this:

Code: Select all

Procedure a(a.s)
  Debug "a: " + a
EndProcedure

Procedure b(a.s)
  Debug "b: " + a
EndProcedure

Prototype funcProto(a.s)

funcPointer.funcProto = @a()
funcPointer("Hello")

funcPointer = @b()
funcPointer("Hello")
User avatar
MrTAToad
Posts: 291
Joined: Sun Apr 20, 2014 11:43 am
Location: Chichester, England
Contact:

Re: Pointers to procedure

Post by MrTAToad »

Great! Thanks!
Post Reply