Considering I'm returning to Lua, I'm not 100% sure if this code will work. I feel like it might, but also that it might not. It's an alternative to dj, but I want it to be able to check for audio, say what song it is, play it, and stop it (with the option to eject it). It at first assumes the drive is on the bottom, but it can be changed by altering the variable "drive" (at least, how I want it to be).
http://pastebin.com/jjX9BKBx - Jukebox Code
Could This Work?
Started by overfritz, Oct 09 2013 10:02 PM
2 replies to this topic
#1
Posted 09 October 2013 - 10:02 PM
#2
Posted 09 October 2013 - 11:24 PM
- input is never declared - how should Lua know what it is?
- You're messing with the disk API, so you don't have to wrap the drive itself,
- Missing parentheses at line 15.
- In an if statement, something = true is not a valid expression. Use the == operator for that purpose. And you don't have to use == true anyways.
- Again, invalid expression: input == "yes" or "no". I have no idea why people think that would work. (Is there a language in which that expression is valid? I'm asking, seriously. If there is one, let me know.) Should be input == "yes" or input == "no".
- Use locals.
EDIT: There is an awesome thing called debugging. It's about observing the program, watching the errors it throws, and fixing bugs. It's not that complicated, try it for yourself:
- Write some code.
- Run the program.
- If there are bugs or the program doesn't work the way you want it to, go back to step 1.
- Profit.
#3
Posted 09 October 2013 - 11:55 PM
LBPHacker, on 09 October 2013 - 11:24 PM, said:
Again, invalid expression: input == "yes" or "no". I have no idea why people think that would work. (Is there a language in which that expression is valid? I'm asking, seriously. If there is one, let me know.)
Spoiler
EDIT: Oh and I do agree btw with LBPHacker, learn to debug programs, it will save you heaps of time, and give you a sense of accomplishment. We're not your slaves, we're not here to test or fix problems in your code. We're here to give you advise when you've run into problems that you've spent a good amount of time on fixing yourself and you just cannot find the problem.
Edited by theoriginalbit, 10 October 2013 - 12:00 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











