That is to say, you're wanting to capture and use the return values. Switch:
male()
female()
if male == false then -- "male" is a function, not true or false.
print("False.")
end
if female == false then -- "female" is a function, not true or false.
print("False.")
end
… to:
if male() == false then -- Test the result of executing the male function, as opposed to what male itself is.
print("False.")
end
if female() == false then -- Test the result of executing the female function, as opposed to what female itself is.
print("False.")
end
Note also that this sort of syntax:
if gender == "F" or "f" then
… translates to:
if gender is "F", or "f" is a value, then...
"f" will always be a value (because you literally wrote "f" into the line), so the result will always resolve as true. You meant to do:
if gender == "F" or gender == "f" then
… and that could be simplified using
string.lower():
if gender:lower() == "f" then
Heck, you could even turn this:
function male()
if gender:lower() == "m" then
return true
else
return false
end
end
… into this:
function male()
return gender:lower() == "m"
end
Though frankly I'd be inclined to just ditch the male/female functions altogether.