Page 1 of 1

[Implemented] ListSize

Posted: Wed Oct 12, 2022 8:29 pm
by User_Russian
From help
safely used to determine if a list is empty or not.
Using the function is not safe! The application is crashing.

Code: Select all

DisableDebugger
NewList x()
FreeList(x())
MessageRequester("", Str(ListSize(x())))

Re: ListSize

Posted: Wed Oct 12, 2022 9:09 pm
by normeus
if you might use the list again use:

Code: Select all

ClearList(x())
It frees memory like FreeList() but the List reference is still available. FreeList() makes it like the variable never existed.


Norm.

Re: ListSize

Posted: Wed Oct 12, 2022 9:13 pm
by infratec
if a list is empty or not
After FreeList() you have no list. So it is correct.
It is not a procedure to test if a list is available or not.

Re: ListSize

Posted: Wed Oct 12, 2022 9:21 pm
by infratec
Maybe a FeatureRequest for IsList() is a good idea.

Re: ListSize

Posted: Wed Oct 12, 2022 10:19 pm
by STARGÅTE
I would prefer that ListSize() gives -1 if the list is not initialized, as it is the behavior for arrays.

Re: ListSize

Posted: Thu Oct 13, 2022 5:37 am
by Denis
STARGÅTE wrote: Wed Oct 12, 2022 10:19 pm I would prefer that ListSize() gives -1 if the list is not initialized, as it is the behavior for arrays.
+1

Re: ListSize

Posted: Fri Mar 10, 2023 9:51 pm
by Andre
Moved to 'Feature requests'