I got the answer from someone, but what they gave me had an error. This is what I had for the script he answered:
function SayHello(Name) print(Name..'!') end SayHello("Hello Narblet") OUTCOME --> Hello Narblet! SayHello("Hello FUDGEWAD") OUTCOME --> Hello FUDGEWAD!
They are saying there is an error in Line 7. But I don't see what the problem is. Please help me.
You can't include random pieces of English inside your program.
The Lua interpreter will believe it's code and cause problems.
If you need to include explanatory text, you have to use comments (using a double hyphen)
function SayHello(Name) print(Name..'!') end SayHello("Hello Narblet") -- Hello Narblet! SayHello("Hello FUDGEWAD") -- Hello FUDGEWAD! -- (or like this if you prefer): -- OUTCOME --> Helo FUDGEWAD
(In this editor, comments (the stuff that Lua ignores) is highlighted green. Compare with what you originally posted)
From comments:
Comments don't do anything. The computer ignores them. So why would you ever have comments in code?
While they don't mean anything to Lua, they do (should) mean things to humans writing and reading code. You write comments to make explanations to yourself or to others using your code (like you had).
Good code includes comments.
On the other hand, since comments make Lua ignore pieces of the program, it's frequent that you'll see things like this:
x = x ^ 0.5 -- x = math.sqrt(x)
Where some code has been "commented out" to be ignored. While this can be convenient for debugging, in the long term it's almost universally considered to be bad practice to have this commented-out code remain.