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

Exception - bios:206: [string "startup"]:4: '=' expected. Why?

Started by Beatsleigher, 02 April 2013 - 02:23 PM
Beatsleigher #1
Posted 02 April 2013 - 04:23 PM
Hey guys,

I asked this in a thread I posted earlier, but no answers to it, so I'm asking again, in the hope someone can help me :)/>

I get the following exception: bios:206: [string "startup"]:4: '=' expected .

My code is as follows:


write("Would you like to load the To-D- program?")
answer = read()
if answer=="Y" then
run monitor top ToDo
elseif answer=="N" then
clear()
print "Select a program you would like to load from the list below:"
print "1. ToDo (Top monitor)"
print "2. ToDo (This computer)"
print "3. Server Rules (Top Monitor´)"
print "4. Server Rules (This Computer)"
print "5. List of Permitted Users (Top Monitor)"
print "6. List of Permitted Users (This computer)"
print "7. Load Time App (Top monitor)"
print "8. Load Time App (This Computer)"
write("Write in the number of the desired program below: ")
programs = read()
if programs=="1" then
run monitor top ToDo
if programs=="2" then
run ToDo
if programs=="3" then
run monitor top Rules
if programs=="4" then
run Rules
if programs=="5" then
run monitor top PermUsers
if programs=="6" then
run PermUsers
if programs=="7" then
run monitor top time
if programs=="1" then
run time

It's basic code (I'm a n00b when it comes to Lua and Java, I can only code in Batch and VB) so I don't understand what went wrong.

Any help is much appreciated!

Thanks, Beatsleigher.
faubiguy #2
Posted 02 April 2013 - 06:19 PM
if you want to run a program from inside of a program, you need to use shell.run, like
shell.run('program', 'argument1', 'argument2')

So replace every line like
run monitor top ToDo
with
shell.run('monitor', 'top', 'ToDo')

You also need to have an end statement for every if statement, to mark where the code in the if statement (that you only want to run if the condition is true) ends, like
if condition then
  -- Do stuff
end
PixelToast #3
Posted 03 April 2013 - 04:57 PM
its also useful to use elseifs instead of repeating if statements

if var==1 then
  -- suff
elseif var==2 then
  -- moar stuff
end
you can add as many elseifs you want before ending