Jump to content

Coding lua?


Not Steve
 Share

Recommended Posts

Can anyone here that codes lua help me and tell me what I am doing wrong in my basic code as I am learning to do this kind of stuff <3

 

 

 

local age = 20

if age = 20 then

print ("You're 20!")

elseif age > 20 then

print ("You're under 20")

else age < 20 then

print ("You're over 20")

end

 

 

I get this everytime

 

[ERROR] lua/age.lua:2: 'then' expected near '='

 

  1. unknown - lua/age.lua:0

Link to comment
Share on other sites

Try and replace any '='  not assigning a value with '==' as '==' is equal to "is equal to."

 

This is based off of my Java experience, so it may not be the same.

 

I can explain in further detail in the PM System if you choose. (If I am correct, of course...)

Link to comment
Share on other sites

for k, v in pairs( player.GetAll() ) do

if ( v:Alive() ) then

print("you are alive")

elseif (v:Alive() ) == false then

print("you died")

end

end

 

 

 

Can anyone identify what this does? I have just coded it and it works ;)

 

 

NO CHEATING AND COPY/PASTE IT INTO CONSOLE!

Link to comment
Share on other sites

for k, v in pairs( player.GetAll() ) do

if ( v:Alive() ) then

print("you are alive")

elseif (v:Alive() ) == false then

print("you died")

end

end

 

 

 

Can anyone identify what this does? I have just coded it and it works ;)

 

 

NO CHEATING AND COPY/PASTE IT INTO CONSOLE!

I do not code lua but I assume it says you are dead or alive?

Link to comment
Share on other sites

for k, v in pairs( player.GetAll() ) do

if ( v:Alive() ) then

print("you are alive")

elseif (v:Alive() ) == false then

print("you died")

end

end

 

 

 

Can anyone identify what this does? I have just coded it and it works ;)

 

 

NO CHEATING AND COPY/PASTE IT INTO CONSOLE!

I do not code lua but I assume it says you are dead or alive?

 

Shhhh <3 Ill +1 your rep for answering that good xD

Link to comment
Share on other sites

I am trying to use the Wiki. The reason why I'm getting so happy is cause for some reason on the wiki, after the basic if, elseif, else it seems to throw in a ton of stuff I have no idea what I am typing, and this is the first line of code I did without help lol. If you have any links I can really learn off of for this, then PLEASE provide them.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...