Visual editor for image type and custom functions

When you use the sprite() function, the first parameter (or even lack thereof) highlights blue and if you click it then it opens the visual editor for sprite graphics. Pretty awesome.

However, if I have my own custom function and want to take a sprite graphic as a parameter, I don’t think there’s a way to get it to give the blue highlight and the visual editor.

I think the easiest solution is for the image() function to behave like the sprite() function, and highlight the first parameter when it is using the single-parameter overload, or just highlight the empty parens when it doesn’t have any parameters yet, and to use the visual editor in that way. Then the image instance can just be passed and the visual editor is still available when using custom functions. (I think this is consistent with the way the color() type works with its constructor function.)

You can use readImage() in this way, but you make an interesting point. The image() constructor could accept a sprite key to load.

I made a sprite picker class.

with last version of codea, i have
error: [string " …"]:60: Invalid buffer name

and copy/paste function in print area does’nt work, before it’s work, is’nt it ?

sorry SkyTheCoder my project’s name was Sprite Picker with space between.
It works fine, it’s a good idea, thanks for share