Transferring input text data to an array

Get help using Construct 2

Post » Tue Jul 30, 2013 2:55 pm

Hey folks. Quick question: can anyone come up with a way to do the following:

- Have a text box of n lines
- Iterate through each line, and fill an array with said line until no more are left

This would be trivial for any other programming tool but I can't seem to find anything in C2 which can do it easily.
B
55
S
12
G
8
Posts: 339
Reputation: 9,364

Post » Tue Jul 30, 2013 3:00 pm

Nevermind, got it!

Psuedocode:

local number token = 0
Repeat (tokencount(textbox.text, newline) times
-> Push back Array (tokenat(textbox.text, token, newline)
-> Add 1 to token

EDIT: instead of the local variable you can actually just use loopindexcow_trix2013-07-30 15:06:49
B
55
S
12
G
8
Posts: 339
Reputation: 9,364


Return to How do I....?

Who is online

Users browsing this forum: unxcellent and 8 guests