Small Basic Forum
LDArray extension - Printable Version

+- Small Basic Forum (https://litdev.uk/mybb)
+-- Forum: Small Basic (https://litdev.uk/mybb/forumdisplay.php?fid=1)
+--- Forum: Extensions (https://litdev.uk/mybb/forumdisplay.php?fid=3)
+--- Thread: LDArray extension (/showthread.php?tid=154)

Pages: 1 2


RE: LDArray extension - litdev - 11-19-2024

Hi,

1] You have to add the items in a loop one at a time, or if they can be set from an existing SB array (LDList.CreateFromIndices or LDList.CreateFromValues) or from a file (LDList.Read), so it depends on the source of the data for the list.

2] When an item is added to the List it is appended to the end.  Internally the items in a list are re-ordered as the list changes, so the indices always run from 1 to LDList.Count.


RE: LDArray extension - AbsoluteBeginner - 11-19-2024

(translated by Google translator)

Yumda,
I can suggest one more way how you can add several words to the list at once.
This can be done using the LDList.Append(listName1, listName2) method.
This method adds the second list to the end of the first list.

Shy


RE: LDArray extension - Yumda - 11-20-2024

so, if I understand correctly the ldlist is like creating a text file say --- vocablist, and within that file it contain the data or words in this case, am I correct to visualise like this? The trouble for me is that if I can not understand the logic I just could not utilise it. And the indices would be the order of the words in the file...

Am I correct by thinking it like this?


RE: LDArray extension - litdev - 11-20-2024

Hi, LDList uses the C# List object.  You can't loads of info on it by googlung, "C# List".  For example https://www.c-sharpcorner.com/article/c-sharp-list/

Also you could look at the source code I use in LD extension.

Ultimately these give the full definition, the other way is to experiment with it and ask questions with specific example code you are working on that doesn't behave as you would want.


RE: LDArray extension - AbsoluteBeginner - 11-20-2024

(translated by Google translator)

I like the name "List".  Shy

This name creates the correct image.
Here is the list:
  1. Bla-bla
  2. Bla-bla-bla
  3. Ha-ha-ha-ha-ha
Everything is clear here. It is simple and convenient.
The indices are the line numbers.

Cool


RE: LDArray extension - jrmrhrb00 - 11-20-2024

Yumda says:

so, if I understand correctly the ldlist is like creating a text file say --- vocablist, and within that file it contain the data or words in this case, am I correct to visualise like this? The trouble for me is that if I can not understand the logic I just could not utilise it. And the indices would be the order of the words in the file...

Am I correct by thinking it like this?

Yumda,

Yes you are correct. It is just lines of text with the indexes in front of them. Here is a code snippet to see how it works.

filepath="c:\temp\myfolder\myfile.txt"
name="myList"
LDList.Add(name,"Dog")
LDList.Add(name,"cat")
LDList.Add(name,"Rat")
LDList.Print(name)
LDList.write(name,filepath,"False")

'Then look in the filepath and you will see your list as a .txt file

I hope this helps!

JR


RE: LDArray extension - Yumda - 11-21-2024

Lots of Thanks to AbsoluteBeginner, Litdev and jrmrhrb00 for all your help. A new learning curve, but I got it.

Thanks!!!

regards


RE: LDArray extension - AbsoluteBeginner - 11-21-2024

(Today, 12:22 AM)Yumda Wrote: Lots of Thanks to AbsoluteBeginner, Litdev and jrmrhrb00 for all your help.  A new learning curve, but I got it.

Thanks!!!

regards

We are glad that everything worked out for you.  Shy

We wish you good luck.  Wink