This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Noodle's profile picture

readLine ?

Started by Noodle, 11 April 2012 - 12:52 AM
Noodle #1
Posted 11 April 2012 - 02:52 AM
How do you correctly readLine() ??
I'm making a login for my OS and it has a file that has the username and password on it.
There is a Username and Password on the one file.
How do I get it to read where it says User = "" and pass = "" ?
Luanub #2
Posted 11 April 2012 - 03:00 AM
Probably the best way to match them up would be to read the contents on each file into a string, then split the string and covert it into a table then run a check like..


if username == userfile[x] then
do stuff
end

You will have to do this for each line in the table. You can do table.maxn(tablename) to get the count and do a for loop like..


local a = table.maxn(userfile)
for x=1, a do
if username == userfile[x] then
do stuff
end
end