1 posts
Posted 31 March 2015 - 01:48 AM
so have a problem with my startyp on my computer and need help
rs.getInput("left")
os.run("Birthday")
end
so my error is this weridness
[string"startup"]:3: '<eof>' expected
2427 posts
Location
UK
Posted 31 March 2015 - 02:05 AM
remove line 3, files don't need "end" to mark the end (the <eof> character does this - this is added by the OS for you)
Also, in case you have not noticed, questions like this go in the "ask a pro" section of the forums and it helps if you give the post a more descriptive title
Edited on 31 March 2015 - 12:08 AM
3057 posts
Location
United States of America
Posted 31 March 2015 - 02:55 AM
I remember when I did that… took me three weeks to figure out what I was doing wrong.
Anyway, end doesn't mean the end of the file, it means the end of a statement, for example:
if var == "hi" then
--#do stuff
end --#you add an end here to end the if statment
while true do
--#stuff
end --#you add an end here to end the while loop
Basically, it tells the interpreter "after this point, code will not be in the last statement"
779 posts
Location
Kerbin
Posted 31 March 2015 - 01:24 PM
I think you want to run the Birthday only when it's redstone signal on the left. In this case you need an if statement:
if rs.getInput("left") then
2427 posts
Location
UK
Posted 31 March 2015 - 03:09 PM
if you are putting in the if statement, then you will need to leave the "end" at the end
Complete code will be:
if rs.getInput("left") then
shell.run("Birthday") --#was os.run("Birthday"), this causes problems with environments I believe. edit2: yes, see wiki
end
edit: change to shell.run
edit2:
http://computercraft.info/wiki/Os.run
Edited on 31 March 2015 - 02:35 PM
1140 posts
Location
Kaunas, Lithuania
Posted 31 March 2015 - 04:29 PM
And to add to all of that code, you'd probably want to use shell.run instead of os.run.
if rs.getInput("left") then
shell.run("Birthday")
end