5 posts
Posted 12 June 2013 - 04:30 PM
Title: <eof> expected
I have recently created a voice control programs using misc peripherals. I realize that this isn't a forum or misc peripherals, but I'm 95% sure that it's my coding, and not a problem with misc peripherals. The code and be found here:
pastebin.com/iZr7m6CS . I've looked around, and I can't find a solution. The specific error is "bios:337: [string "voiceControl"]:21: '<eof>' expected. Any help would be very helpful.
8543 posts
Posted 12 June 2013 - 05:13 PM
Split into new topic.
The usual cause of that error is having an extra `end` someplace, and the usual cause of that is using if clauses incorrectly. If that is the case, then you'd want to make sure that all of your if blocks have the if / elseif / else / end structure rather than if / end / elseif / end / else / end. I'd look at your code to confirm, but not only is it over on pastebin rather than posted here, but it's also not even a link! :P/>
1688 posts
Location
'MURICA
Posted 12 June 2013 - 05:57 PM
What is the code of your "listen" program? The error points to line 21, which doesn't exist in the code you've given.
7083 posts
Location
Tasmania (AU)
Posted 12 June 2013 - 07:22 PM
Down the bottom, you have:
listen()
shell.run("listen")
So if I'm understanding this correctly, you call your listening function once, then you have the script run itself (the same script) again.
This won't work, or even if it will, it won't work forever. Every time the script calls itself, the Lua interpreter has to keep track of another running version of the script - none of these ever end, as they're all waiting for yet more instances of the script to end. This will eventually crash your program by way of overflow (you'll max out the RAM Lua reserves for such shenanigans).
Instead use:
while true do
listen()
end
5 posts
Posted 12 June 2013 - 10:02 PM
Sorry, I posted the wrong link. The correct on is
pastebin.com/iDqyi89d. I have now fixed this, thanks. And thanks for the tip Bomb Bloke.
7083 posts
Location
Tasmania (AU)
Posted 12 June 2013 - 10:14 PM
Once the peripheral is wrapped to 'p', it stays that way. You don't need to do it again.
You need to rednet.open("WhateverSideTheModemIs") before you can start broadcasting.
This script also has the same issue as the other one you linked.
I can't see any particular reason for the specific error you're getting.
5 posts
Posted 13 June 2013 - 12:02 AM
I've fixed it now. I had to many ends. I realized I didn't need to wrap anymore, so that's why I stopped. I do rednet.open("left") in startup.