How do I read a word list into an array

Get help using Construct 2

Post » Mon Jun 09, 2014 2:56 pm

I´m making a learning tool, and I have a 6000 word list as a txt file, the words separated by newline.

1. How do I read it into an array? I know it should be in a Json format, but I can´t seem to find pointers as to how to edit the list to the correct format. (Hoping for a search and replace job on the list.)

2. Is searching a 6000 element array fast enough to check for the existence of a word?
By this I mean that when the user suggests a word I want to run it through the array using "contains value" to see if it is correct, without making the user wait.

Any help would be appreciated. :-)
B
5
S
1
Posts: 23
Reputation: 471

Post » Mon Jun 09, 2014 3:04 pm

If your vision so exceeds your ability, then look to something closer.
Moderator
B
131
S
29
G
81
Posts: 5,328
Reputation: 56,630

Post » Mon Jun 09, 2014 7:27 pm

Thanks! Interesting read.
Am I correct in concluding that I need to get my list formatted like this:

{
"c2array":true,
"size":[6000,1,1],
"data":[
["word1"],
["word2"],
["word3"],
["word4"]
]
}

and save the file as words.json to import it?
Looked for converters but nothing useful showed up. Guess I´ll try Word and Notepad to get it right.

What about the search speed? Anybody experienced these?
B
5
S
1
Posts: 23
Reputation: 471

Post » Mon Jun 09, 2014 7:50 pm

You can format your text file with notepad++ and regular expressions. If you want send me your file and i do that.
B
11
S
3
Posts: 39
Reputation: 814


Return to How do I....?

Who is online

Users browsing this forum: Colludium, varr, Yahoo [Bot] and 3 guests