dan200 / ComputerCraft

Programmable Computers for Minecraft
Other
964 stars 199 forks source link

os.run({}, "system/terminal") returns error bios:14: [string "terminal"]:7: 'then' expected #593

Closed Flipp3rrr closed 5 years ago

Flipp3rrr commented 5 years ago

As said in the title the command os.run({}, "system/terminal") returns the error bios:14: [string "terminal"]:7: 'then' expected, while at the wiki the same command is used. Is this a problem with my code or with ComputerCraft?

Here's the full script:

term.clear()

print("Booting into protected volume...")
sleep(1)
print()

print("User:")
inp_user = read()
if inp_user ~= "root" then
  print("User doesn't exist!")
  sleep(3)
  os.reboot()
end

print("Password")
inp_pass = read("*")
if inp_pass ~= "Password" then
  print("Incorrect password!")
  sleep(3)
  os.reboot()
end

print("Welcome Administrator!")

sleep(3)
term.setCursorPos(1,1)
term.clear()

os.run({}, "system/terminal")

And here's the script I'm trying to run:

print("Starting FlipOS shell...")

local termActive = true

while termActive do
  input = read()
  if input = "exit" do
    termActive = false
  end
end
JasonTheKitten commented 5 years ago

Please post this type of question (here)[https://forums.computercraft.cc/index.php?board=13.0] before opening a new issue.

SquidDev commented 5 years ago

To expand on Jason's comment, this is a bug in your code. The message means there's a syntax error in your code.

If you look at line 7 of your terminal file, you have if input = "exit" do. This should be if input = "exit" then.

Flipp3rrr commented 5 years ago

@JasonTheKitten The explanation at the wiki said this is correct so I thought it was a bug. That's why I posted it but I found out the os.run() wasn't the problem. Sorry.

Flipp3rrr commented 5 years ago

@SquidDev I changed the program, it's now:

print("Starting FlipOS shell...")

local termActive = true

while termActive do
  input = read()
  if input = "exit" then
    termActive = false
  end
end

But this still gives the same problem!

JasonTheKitten commented 5 years ago

input=="exit", two =s

Flipp3rrr commented 5 years ago

Shit, sorry.