False or not to false?

Apr 11, 2014 at 1:32 PM
    public class TestLuaGlobal : LuaGlobal
        public TestLuaGlobal(Lua lua) : base(lua) { }
        private bool NeoLuaTestBool()
            return false;
with this Lua script
opB = NeoLuaTestBool()
print('opB =',opB)
if opB == false then
   print('OK opB=false')
if opB == False then
   print('OK opB=False')
Produces the following output
opB = False
OK opB=false

Why display boolean is it different with a capital letter?
Apr 11, 2014 at 3:37 PM
opB = NeoLuaTestBool() -- Returns a boolean and stores it in a member from type object
print('opB =',opB) -- Prints the value with the Convert.ToString function of the .net framework. They convert false to "False".
if opB == false then -- compares the object with the constant false --> (bool)opB == false result is true
   print('OK opB=false')
if opB == False then -- compare the object with an empty member --> Object.Equals(opB, False) result is false, because the objects are different
   print('OK opB=False')

if not opB then -- is a better style, not (bool)opB --> true

if not false then --> not false --> true

if not False then --> not (bool)False --> False is null/nil so it is false --> true
Did I make it clear?
Marked as answer by PapyRef on 4/11/2014 at 8:21 AM
Apr 11, 2014 at 4:21 PM
Yes. Thank's