Page 1 of 1

GetListPositionStackSize(MyList())

Posted: Thu Feb 08, 2024 7:19 am
by jacdelad
Hello,
I know, I can do this by using a variable to keep track on, but I'd wish to see a builtin function to determine how many elements are currently on the stack used with PushListPosition(List())/PopListPosition(MyList()). This would be more comfortable.

Re: GetListPositionStackSize(MyList())

Posted: Thu Feb 08, 2024 8:03 am
by Bisonte
Interesting !

I always thought it was only possible with one element at a time....

But it seems not.

Code: Select all

NewList a()

For i = 1 To 10
  AddElement(a()) : a() = i
Next i  

ForEach a()
  If a() > 2 And a() < 6 
    PushListPosition(a())
  EndIf
Next

For i = 1 To 3
  PopListPosition(a())
  Debug a()
Next i

Re: GetListPositionStackSize(MyList())

Posted: Thu Feb 08, 2024 7:24 pm
by Little John
Bisonte wrote: Thu Feb 08, 2024 8:03 am Interesting !

I always thought it was only possible with one element at a time....
Here is detailed information about PushListPosition() and PopListPosition() by freak.

PS: A new built-in function GetListPositionStackSize() is overkill IMHO. Using a variable for this purpose is easy.

Re: GetListPositionStackSize(MyList())

Posted: Thu Feb 08, 2024 7:37 pm
by jacdelad
...and as you can see, I read it some time ago. :mrgreen:
However, the positions themselves are surely stored in some list internally and while we totally can use a variable to keep track on the stack size, it should be just a few lines to fulfill my request.
However again, I'm not mad if this doesn't become a thing. I could use it right now and...you guessed it...I am using variable right now.

Re: GetListPositionStackSize(MyList())

Posted: Thu Feb 08, 2024 8:04 pm
by Little John
jacdelad wrote: Thu Feb 08, 2024 7:37 pm ...and as you can see, I read it some time ago. :mrgreen:
So what? My above link to freaks post obviously was for Bisonte, not for you. :mrgreen: