ZScript Function Pointers

Moderator: GZDoom Developers

Post Reply
User avatar
Gutawer
Posts: 469
Joined: Sat Apr 16, 2016 6:01 am
Preferred Pronouns: She/Her

ZScript Function Pointers

Post by Gutawer »

So, I realise this probably isn't likely to happen, and there's probably some reason its impossible, but on the off-chance that it is doable, I might as well ask - it'd be nice to be able to store a reference to a function and call it from that reference. For example, I am creating a GUI system using the ZScript menus, and it seems like the most sane way to implement button commands would be through a function pointer that executes the function when the button is clicked.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ZScript Function Pointers

Post by Graf Zahl »

Not going to happen.
argv
Posts: 184
Joined: Tue Aug 30, 2016 4:47 pm

Re: ZScript Function Pointers

Post by argv »

You can work around the lack of function pointers like early Java did: with an abstract “event handler” class, and concrete classes that override its method.

Alternatively, you could write a subclass of your button class, which overrides its “button clicked” method to perform the action.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”