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.
GetListPositionStackSize(MyList())
GetListPositionStackSize(MyList())
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: GetListPositionStackSize(MyList())
Interesting !
I always thought it was only possible with one element at a time....
But it seems not.
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
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: GetListPositionStackSize(MyList())
Here is detailed information about PushListPosition() and PopListPosition() by freak.Bisonte wrote: Thu Feb 08, 2024 8:03 am Interesting !
I always thought it was only possible with one element at a time....
PS: A new built-in function GetListPositionStackSize() is overkill IMHO. Using a variable for this purpose is easy.
Re: GetListPositionStackSize(MyList())
...and as you can see, I read it some time ago.
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.

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.
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
-
- Addict
- Posts: 4779
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: GetListPositionStackSize(MyList())
So what? My above link to freaks post obviously was for Bisonte, not for you.
