lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi
You're teaching yourself how to program, asking questions as needed, etc ... This is all good.

Others are answering your question directly, so I'll be different

One of the lessons that rarely, if ever, appears in any text is "Code it up and try it out".
Don't worry, you won't break anything
And you will learn more about writing software 
You also will learn exactly what Lua does ... Not what the manual says it will do or what other programmers say it will do (neither of which are infallible ... Though in this case, I expect they both are right)


 Monday, April 24, 2017, Bill Kelsoe wildbillkelsoe@gmail.com wrote:
In Chapter 3 concerning relational operators expressions, PIL says that "if values have different types, Lua considers them not equal"

So if I understood this, this means that if a boolean and a string are related, using ~= , means that they are like apples and oranges?

Because right after that statement, "Otherwise, Lua compares them according to their types."

So if a value is Boolean meaning either true or false, and the other comparator is a String, of the value "true", so they are evaluated equal by Lua even if ~= is used?

hope I understood it correctly.