-
-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a syntax to get the recursive size of a list #1869
Comments
In theory, it's right. You've got to picture it as testlist having the value "test" and then another value. That other value is a list but still regarded as 1. |
Might be hard to fix but i can confirm. But it is not related to the size expression (assuming it shouldn't count nulls in the list). A better test code would be command /listtest:
trigger:
add "test" to {_list::*}
add "test2" to {_list::sublist::*}
add "test3" to {_list::sublist2::*}
add "test4" to {_list::sublist3::*}
set {_list::sublist3} to true
broadcast "%{_list::*}%"
broadcast "---------"
loop {_list::*}:
broadcast "%loop-index%: %loop-value%" broadcasts Somehow it includes sublists and returns null values for them, because they don't have actual values (like the true in the code above). About the loop, it is a known issue you can't loop variable indexes that doesn't have a value, now we see reason of this ^^ The loop will broadcast |
Yeah, I agree with nfell that this isn't exactly incorrect; looping a list doesn't iterate over sublists (and never has), but the sublist is still part of the list so it returns when checking its size. That being said, this is obviously somewhat confusing and Skript could really use some improved list expressions -- namely the ability to deep loop over lists, via a new syntax so it doesn't break old loops. Something like MundoSK's I'll leave it to devs to decide if they want to take any action on this. |
@TheBentoBox - without breaking current looping systems as scripts would of been designed to accommodate the fact that Skript doesn't loop sub-lists. Potentially it could be an easy thing such as:
What I'm trying to say is, would Skript loop every sub-list or just the first level of sub-lists? Would a condition like |
This is not exactly easy to implement, but might be handy. |
Issue:
The "size of {_list::*}" variable seems to be broken. It returns wrong number.
Version:
[15:49:42] [Server thread/INFO]: [Skript] Enabling Skript v2.3.2
[15:49:42] [Server thread/INFO]: [Skript] Timings support enabled!
[15:49:43] [ForkJoinPool.commonPool-worker-1/INFO]: [Skript] You're currently running the latest stable version of Skript.
Example command:
Result:
The text was updated successfully, but these errors were encountered: