0

How to add arguments to functions
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How to add arguments to functions

by bhedrick on Sun Apr 08, 2018 9:29 am

I created a new function and then went into the javascript window to add arguments. I receive the error "Oops, something went wrong when trying to convert your code." Any ideas?

function setPixelColor(x: number, y: number) {

}

bhedrick
 
Posts: 6
Joined: Sat Sep 01, 2012 1:09 pm

Re: How to add arguments to functions

by bhedrick on Mon Apr 16, 2018 2:06 pm

I didn't figure out how to do this. In the meantime, I end up creating a package on github, and then added it as an extension, to do what I needed.

https://github.com/hedrickbt/pxt-clr-text

bhedrick
 
Posts: 6
Joined: Sat Sep 01, 2012 1:09 pm

Re: How to add arguments to functions

by GuitarHero on Wed May 02, 2018 9:23 am

Your extension adds a block for a single javascript function charCodeAt() to the MakeCode editor.
But what about the functions created with the MakeCode editor itself?
If I call "ADVANCED - FUNCTIONS - Make a Function - New function Name - xyz", there is no way to add parameters to this new function.
Does anybody have a solution for that?

GuitarHero
 
Posts: 5
Joined: Fri Apr 06, 2018 10:01 am

Please be positive and constructive with your questions and comments.