ComputerCraft

ComputerCraft

21M Downloads

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

Flipp3rrr opened this issue ยท 6 comments

commented

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
commented

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

commented

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.

commented

@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.

commented

@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!

commented

input=="exit", two =s

commented

Shit, sorry.