#Allocated List ?

1 messages · Page 1 of 1 (latest)

stable verge
#
broadcast ""

Loop { Holo.%expression-1%::* }:
  broadcast "%loop-counter% . %name of { Holo.%expression-1%::%loop-counter% }%"

remove { Holo.%expression-1%::%expression-3% } from { Holo.%expression-1%::* }

broadcast ""

Loop { Holo.%expression-1%::* }:
  broadcast "%loop-counter% . %name of { Holo.%expression-1%::%loop-counter% }%"```
thin onyx
#

Lists in skript work like maps

#

Removing an element will not affect any other elements

stable verge
#

Can't we make it shrink ? because removing let's say the 2nd element of the variable like remove x from {T::*} doesn't make it shrink. Accessing the 2nd element after removing gives none

thin onyx
#

Yes, like I said, it's a map

#

The string "2" no longer points to anything because you removed it

#

It does not act like an array

stable verge
#

damn, any solutions/other options ?

thin onyx
#

Well I would suggest not relying on that behavior at all

#

But if you must, you can be inefficient and set list to list to reset the indices

#

But you shouldn't do that if you can avoid it

stable verge
#

yea, I can skip it by just looping it and accessing loop-value instead of looking up by index from the loop itself - but it was general question about it

#

Thanks

thin onyx
#

If you just want the xth element, you can use ExprElement

stable verge
#

can you show me an example ? never heard of the ExprElement

#

oh like 2nd element of

thin onyx
#

That's the class name (Expr[ession] element)

#

Yeah

stable verge
#

oh yea that could work for me

#

thanks

#

doing the set list to list, how bad is it ?

#

if it's not in a tick, but rather a few times like editing a custom hologram - doesn't happend often

thin onyx
#

So depends on how big the list is

stable verge
#

oh okay, it's only a few perhaps 2-5 and at most 10

#

I'll be okay haha

#

Thanks

#

uh perhaps not the place to ask but in regards to custom expressions, effect and so forth from skript-reflect - Does it effect performance using a lot of those or is it like compiled down, like inline would be ?

I have no clue how skript works internal, can't be asked to look thorugh the source code o.O Not even sure if I would even find out

thin onyx
#

There is no compilation

#

Custom expressions are basically as good as functions