@YuHayate you can shove whatever extra properties you want into a Sprite using the sprite.data property.
For example:
console.log(sprite.data.name) // prints "undefined"
sprite.data.name = "josephine"
console.log(sprite.data.name) // prints "josephine"
console.log(sprite.data["name"]) // prints "josephine"
Just be aware that the sprite.data property has the any type so you need to be careful when accessing properties off of it. The compiler won’t catch any spelling or type errors
That code will break. I’m note sure what you’re trying to do here exactly either…
Like @richard said, to assign a name to a sprite, do sprite.data.name = "name"
To retrieve it just grab sprite.data.name or sprite.data["name"]
it was an example, what i want is to get the name of the variable like the text we use to declare set modify the variable
like if we declare a variable like let NameOfSprite = "anything"
i want a way to get the name of the sprite (in this case NameOfSprite) and return it as a string
well if i want to use throw "" with a function a make to replace all <‘number’> to a string in a array at index ‘number’, i wanted to get a sprite name to make the error look more clear
@YuHayate do you mean a specific javascript library?
extensions are themselves libraries. however, if you’re trying to use some 3rd party non-makecode library it will really depend on the implementation as to whether it will work or not. most likely it will not work unless the library is very very simple.
hey @richard! i was making a extension and i tried to make a total run time function using settings.
but instead of keeping track of the total time like in This, so in that example i use the better settings extension here.
but if i use setting. from the javascript editor it just makes makecode not work? it just makes the editors not work or take 5 minutes to load