Page 1 of 1

Pointers to procedure

Posted: Sun Oct 16, 2016 1:09 pm
by MrTAToad
Is there any way of calling a procedure held in a variable pointer ?

Re: Pointers to procedure

Posted: Sun Oct 16, 2016 2:14 pm
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")

Re: Pointers to procedure

Posted: Sun Oct 16, 2016 2:23 pm
by MrTAToad
Great! Thanks!