 |
Derar Novice
Joined: 09 Sep 2006 Posts: 44
|
Posted: Tue Aug 10, 2010 2:27 pm
[3.22a] Feature Request - Dynamic Function Call |
Would be nice if the following parsed out successfully:
| Code: |
$func = "_TestFunc"
#CALL @{$func}($arg1, $arg2)
|
Similar to how this works:
| Code: |
$var = "TestVar"
$var2 = @{$var}
|
You can sort of hash together something really ugly with #EXEC and %concat, but... it's messy and it gets weird when you start to try to include db vars as parameters.
Example:
| Code: |
$func = "_TestFunc"
#EXEC {%concat("#CALL @", $func, "(", $arg1, ", ", $arg2, ", ", $arg3, ")")}
|
You can also make it work pretty much fine with an alias instead of a function, but would be nice to have an easy way to call it dynamically as a function.
Alternatively, if somebody's got an idea on how I can do that now... :) |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Aug 10, 2010 4:00 pm |
I think that's actually a bug. It parses and compiles but generates slightly wrong compiled code. So I'll add this to the bug list.
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Aug 18, 2010 8:42 pm |
Looks like this works if the function is a inline variable function, like this:
| Code: |
<alias name="doit" id="3">
<value>$func="testvar"
#show @{$func}(1,3)</value>
</alias>
<var name="testvar" id="5">%eval(%1+%2)</var> |
however, if doesn't work when it's a real function, like this:
| Code: |
<alias name="doit" id="3">
<value>$func="test"
#show @{$func}(1,3)</value>
</alias>
<func name="test" id="4">
<value>#RESULT %eval(%1+%2)</value>
</func> |
In any case, should be fixed in the next version. |
|
|
|
 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|