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

fs.exists and If Problem Please Help

Started by Minerman231, 24 August 2012 - 11:57 AM
Minerman231 #1
Posted 24 August 2012 - 01:57 PM
Well I have a Problem with a login in a program, what I did wrong. Please help my.

term.setCursorPos(15,7)
print"Username: "
term.setCursorPos(15,8)
print"Passwort: "
term.setCursorPos(25,7)
a = io.read()
term.setCursorPos(25,8)
b = io.read()
c=fs.exists(a)

if c=="true" then
shell.run("main")
elseif c == "false" then
sleep(1)
shell.run("false")
end

sjele #2
Posted 24 August 2012 - 02:03 PM
Just how to do it:

c = fs.exists(a)
if c then
shell.run("main")
else
shell.run("false")
end
A possible fix: ( tested in CC emulator )


term.setCursorPos(15,7)
write("Username: ")
a = read()
term.setCursorPos(15,8)
write("Password: ")
b = read()
c=fs.exists(a)
if c then
shell.run("main")
else
sleep(1)
shell.run("false")
end
Minerman231 #3
Posted 24 August 2012 - 09:22 PM
thx, Its now working :D/>/>