Sign in to follow this  

Lua Program isn't working

This topic is 367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So I'm trying to code a simple text fight using Lua, but I keep getting the same error even though I'm doing what it's saying.
Here's the code:
 
print 'A zombie appears. What do you do?'
os.execute("sleep 5")
if sleep = 0 then
  print 'The zombie scratches you and you die.'
Attack = io.read()
print 'The zombie is injured.'
 
It should make it so if you wait five seconds then you die, but here's the error message that shows up: [string "print 'A zombie appears. What do you do?'..."]:3: 'then' expected near '='
I'm not sure what I'm doing wrong.. Can anyone help with this?

Share this post


Link to post
Share on other sites

Wait, nope I got it
 

 

My general feeling is that you should explain what you found out and fixed. There's is nothing more infuriating in the world than having a problem, Googling it, finding someone asking about the same or a similar problem, then seeing a "nevermind fixed" comment with no explanation. :)

Share this post


Link to post
Share on other sites

This topic is 367 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this