Replies: 3 comments
-
I'm pretty sure this is already in the JSON extension. |
Beta Was this translation helpful? Give feedback.
0 replies
-
it is its just missing the "max" part.
…________________________________
From: Cubester ***@***.***>
Sent: Tuesday, September 19, 2023 12:30 PM
To: TurboWarp/extensions ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [TurboWarp/extensions] How to Upload/Submit a Extension (Discussion #1045)
I'm pretty sure this is already in the JSON extension.
—
Reply to this email directly, view it on GitHub<#1045 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BAGGRIB22FOWVQCZ27R4PJLX3HCBTANCNFSM6AAAAAA46RVILI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah I agree. You shouldn't submit something that is a literal downgrade from an already existing extension. If you really want to add your extension or something just create a new pull request with your extension in it with your own folder. EDIT: it gets reviewed so don't expect it to get added |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! I have programmed an extension to convert strings into JSON arrays, and I would like to add it, but I don't know how to do that. Can someone help me with this?
Source code:
class StrictEqualityExtension {
getInfo() {
return {
id: "stringtolist",
name: "String to List",
color1: "#ed5a11",
color2: "#ed5a11",
blocks: [
{
opcode: "split",
blockType: Scratch.BlockType.REPORTER,
text: "Split [STR] by [SEP] [MAX] times",
arguments: {
STR: {
type: Scratch.ArgumentType.STRING,
defaultValue: "ScratchxCat",
},
SEP: {
type: Scratch.ArgumentType.STRING,
defaultValue: "x",
},
MAX: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: "2",
},
},
},
{
opcode: "GetElement",
blockType: Scratch.BlockType.REPORTER,
text: "Item [I] from the String List [STR] times",
arguments: {
I: {
type: Scratch.ArgumentType.NUMBER,
defaultValue: "1",
},
STR: {
type: Scratch.ArgumentType.STRING,
defaultValue: '["Scratch","Cat"]',
},
},
},
],
};
}
split(args) {
var sep = args.SEP;
var str = args.STR;
var max = args.MAX;
if (max <= 0) {
return JSON.stringify(String(str).split(sep));
}
return JSON.stringify(String(str).split(sep, max));
}
GetElement(args) {
var i = args.I;
var str = args.STR;
return JSON.parse(str)[i - 1];
}
}
Scratch.extensions.register(new StrictEqualityExtension());
Beta Was this translation helpful? Give feedback.
All reactions