Discuss Scratch

mmip
Scratcher
15 posts

Extension IndexOf

Hey there! Right now I only had time to create 1 block in my extension.
IndexOf.

(String) indexOf (String you are looking for)

It will return -1 if it doesn't exist in the string.
(function(ext_inde) {

ext_inde._shutdown = function() {};


ext_inde._getStatus = function() {
return {status: 2, msg: 'Ready'};
};

ext_inde.inde = function(string,look) {
return string.indexOf(look);
};

// Block and block menu descriptions
var descriptor = {
blocks: [
// Block type, block name, function name, param1 default value, param2 default value
['r', '%s indexOf %s', 'inde', 'String','Str'],
]
};

// Register the extension
ScratchExtensions.register('javascript_mmip_dap_indexOf', descriptor, ext_inde);
})({});
Jonathan50
Scratcher
1000+ posts

Extension IndexOf

Cool. It can of course be acheived without an extension but then you can't have reporters

Not yet a Knight of the Mu Calculus.

Powered by DjangoBB