Hi I have been using pixilang for less than a week so Im not sure if I am just ignorant or if it is indeed impossible to call functions from within a function since I keep getting syntax errors whenever I try and keep to the same syntax as calling functions outside of the function and that does work.
If this Isnt the case I would like to request this as a feature it would make working in Pixilang a lot more intuitive imo.
Thanks in advance.
Is it possible to make function calls within a function?
- NightRadio
- Site Admin
- Posts: 3944
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: Is it possible to make function calls within a function?
Please show your codesince I keep getting syntax errors
Re: Is it possible to make function calls within a function?
Uh dont know what did wrong the first time but it works... bc ofc it does now. I probably made a mistake somewhere and accidentally fixed it. I was going to write functions in a switch case in the default sunvox curve generator but for the sake of completeness here is the example code.
Code: Select all
fn functionExampleVoid( $x ){
$randomCode = "randomCode";
}
fn functionExampleRet( $x ){
$y = $x;
ret($y);
}
fn curve_function( $x ){
//$y = $x;
functionExampleVoid( $x );
$y = functionExampleRet( $x );
ret( $y );
}
Re: Is it possible to make function calls within a function?
Just FYI Pixilang has high order functions, so you can actually pass around references to functions as I recently learnt: https://warmplace.ru/forum/viewtopic.php?f=6&t=6154