Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dynamic Function Calls?

Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
11-25-2009 11:33
Is it possible with LSL to call functions dynamicly?

Like

func1(){

}

funct2(){

}
integer variable = 1;

state_entry(){

func + 1 + ";();"

}
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
11-25-2009 12:21
no
_____________________
So many monkeys, so little Shakespeare.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
11-25-2009 12:24
No. You have to test "variable" and send to the appropriate function instead.

if (variable == 1) func1();
else if (variable == 2) func2();
Nyx Alsop
Registered User
Join date: 14 Dec 2008
Posts: 252
11-25-2009 12:31
Thanks, thought so, would of just saved time.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-25-2009 12:51
or if you'll be deciding the same thing in multiple places save yourself the trouble and use a picking function
CODE

ufunctionPick( integer x ){
if (x) uFunc1();
else uFunc1();
}


or if both functions are small just combing them and feed it the variable and put the if inside
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -