Scarpet range() is incorrect in some places
SirGavith opened this issue ยท 1 comments
Run /script run range(3)
. It prints in chat: [0,1, ..., 3]
Now run something like this
for(range(3),print(_))
. You'll see that it prints 0
,1
,2
These two different uses of range() indicate different things about how it works.
Even the documentation has this as an example
l(range(10)) => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
This is intended, as range() returns an iterator, whereas if you just run it in chat, it is programmed to by definition give you that initial value, whereas when you run it as a list, it will return the list reformatted as a string.
Basically, in the fist case, you are getting the string of the func, and in the code it is literally funcName.getString()
whereas if you use l()
it returns the function value.
tldr;
WAI