Is it possible to execute code in a loop for each character in a file?
Each charater?
Started by Left4Cake, Oct 05 2012 01:48 AM
6 replies to this topic
#1
Posted 05 October 2012 - 01:48 AM
#2
Posted 05 October 2012 - 01:54 AM
What exactly do you mean?
Execute code..
In a loop..
Each character in a file?
Execute code..
In a loop..
Each character in a file?
#3
Posted 05 October 2012 - 01:54 AM
for char in string.gmatch(file.readAll(), ".") do
#4
Posted 06 October 2012 - 03:04 AM
Do you mean to execute different functions with their own key press? If so, then it's perfectly possible.
You can do something like this:
You can do something like this:
local event,p1 = os.pullEvent() if event == "char" and p1 == "<key>" then <function> elseif <same as above with different key> <function> end
#5
Posted 13 October 2012 - 01:14 AM
MatazaNz, on 06 October 2012 - 03:04 AM, said:
Do you mean to execute different functions with their own key press? If so, then it's perfectly possible.
You can do something like this:
You can do something like this:
I mean to read a file and then execute code for each char in the file as opposed to each line of a file.
#6
Posted 13 October 2012 - 04:22 AM
Sounds simple enough, but probably not too simple. I think you could have a bunch of local variables for each character, and link those characters to functions.
#7
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users











