Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Add a cloner to the queue classinfo

Open Fusezion opened this issue 3 months ago • 3 comments

Suggestion

Implement the .cloner() method on the QueueClassinfo

Why?

Queues do not currently respect the usage of copy {_a} into {_b} due to the missing method and instead just return the original object

Other

While users can work around it using a mixture of set {_b} to a queue of unrolled {_a} this is not intuitive and actively works against the end users

Agreement

  • [x] I have read the guidelines above and affirm I am following them with this suggestion.

Fusezion avatar Oct 25 '25 01:10 Fusezion

Adding a cloner would cause queues to be cloned on function boundaries and setting variables, which would be a breaking change. May or may not be desirable.

sovdeeth avatar Oct 25 '25 01:10 sovdeeth

Would it be wrong to implement an updated cloner? idk if it would be better but if the concern is with general constraints implemented by this. Couldn't we instead have something like

// T = type
new Cloner<T>()
    .supplier(Function<T, T>)
    .permitFunctions(boolean) // false meaning it won't clone in functions

Something along those lines?

Alternatively would probably fall under misuse as I'm not sure of the general guidelines for type properties too much but what about a clone type? Rather than explicitly adding it to the copy x to y syntax which would feel like the required step we can still do it but make it something other addons can implement themselves?

Although I guess it depends how feasible it is. but I feel like it isn't impossible

Fusezion avatar Oct 25 '25 02:10 Fusezion

Yes, the whole cloning/copying api in skript should probably be overhauled imo. It's very poorly documented and inconsistent, and i'm baffled it's worked as well as it has for so long. It also sounds like hell to do that lmao. Some sort of context-dependent system for Cloner would be a good start, though.

sovdeeth avatar Oct 25 '25 02:10 sovdeeth