[Suggestion] dynamic function call

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

[Suggestion] dynamic function call

Post by gouxim »

Hey,

This is a "high end" suggestion. I'm not sure it's even possible. I would love to be able to do dynamic function calls (à la http://php.net/manual/en/function.call-user-func.php) ie. you specify the function name with a String and you pass the parameters in some other way (in php you can either put the params as params of call_user_func, or in an array with call_user_func_array but they require respectively dynamic param numbers and heterogenous arrays - both of which seem not to be possible in ManiaScript).

The obvious use case for that is to implement patterns such as event listener, dependency injection etc. (more precisely I have a standard main loop function, and i would be able to dynamically plug new function that listen to the events on that main loop).
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
Bueddl
Posts: 165
Joined: 27 Jun 2010, 11:39

Re: [Suggestion] dynamic function call

Post by Bueddl »

agree to this, too, I also was coding in that way and looked for that feature.
http://www.tmserver.org | Mania Exchange
═╦═╔╦╗² | MP4 Beta
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: [Suggestion] dynamic function call

Post by gouxim »

moved in the right forum...
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
magnetik
Posts: 1673
Joined: 01 Feb 2012, 19:13
Location: Bordeaux
Contact:

Re: [Suggestion] dynamic function call

Post by magnetik »

+1
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest