Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong comparison with boolean and int #2623

Merged
merged 1 commit into from Jan 5, 2014

Conversation

impaktor
Copy link
Member

@impaktor impaktor commented Jan 5, 2014

I've been offered several missions to transport a group of people, how many? 1.

Looking at the code, it would only have a group larger than one for flavour 0, but not for flavour 1 or 2, which also re groups, since false == 0 is false, or at least that's my understanding of it.

I think this will fix it.

@lwho
Copy link
Contributor

lwho commented Jan 5, 2014

Indeed 0 is true in Lua. Only nil and false are false. Big pitfall for poor C/C++ programmers ;)

@walterar
Copy link
Contributor

walterar commented Jan 5, 2014

Prefer 0 and 1

if x == false then false

if x <1 then false

Save space. :))

@robn
Copy link
Member

robn commented Jan 5, 2014

No, prefer true and false. Much easier to read and understand, and if you want to get really pedantic, marginally faster as well (on the order of single CPU cycles, but still).

Merged :)

@robn robn merged commit 81eab96 into pioneerspacesim:master Jan 5, 2014
@impaktor impaktor deleted the taxi_group_of_one branch January 5, 2014 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants