ikoon Posted October 2, 2017 Share Posted October 2, 2017 Please, in vex, is it possible to define a custom function, which will update the variable, without classic a = function(a) assignment? For example: f@big = 1.5; clamp01(f@big); // function clamps between 0 and 1 f@result = f@big; // result is 1.0 I found nothing, but I am newbie, sorry. Is this technique called "pass by reference", or also "pass a pointer"? Probably not possible in vex? Quote Link to comment Share on other sites More sharing options...
Nache Posted October 2, 2017 Share Posted October 2, 2017 (edited) I ikoon, sure you can, here's examples : vector pos = @P; void cl(vector pos) { pos.y = 0; } cl(@P); void clamp01(float cl) { cl = clamp(cl,0,1); } f@big = 1.5; clamp01(@big); // function clamps @big between 0 and 1 f@result = @big; // paste @big to @result Documentation about it Hope it help, Gab. Edited October 2, 2017 by Nache misspelled name 1 Quote Link to comment Share on other sites More sharing options...
ikoon Posted October 2, 2017 Author Share Posted October 2, 2017 Gabriel thank you very much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.