title: Use 0 or not 0 as boolean in lua[jit]
body: <p>I have a C function that returns 0 or non zero as a boolean to tell the user if all went right.</p>
  <pre><code>/* Returns non-zero on success, 0 on failure. */
  int do_something(void) { 
     int success = NON_ZERO; 
     ...
     if (error) {
         success = 0;
     }
     ...
    return success;
  }
  </code></pre>
  <p>In C, I will use this function as such</p>
  <pre><code>if (do_something()) {
      proceed();
  }
  </code></pre>
  <p>I use the luajit ffi to expose this function to lua</p>
  <pre><code>local ffi = require(&quot;ffi&quot;)
  ffi.cdef[[
  int do_something(void);
  ]]
  do_something = ffi.C.do_something
  </code></pre>
  <p>Problem is, lua doesn't want to use the integer return value as a boolean true/false.</p>
  <pre><code>if (do_something()) then
     -- do_something() always evaluates to true no matter the return value
  end
  -- I have to do
  if (do_something() ~= 0) then
     -- only executed if return value is non-zero
  end
  </code></pre>
  <p>How do I get lua to evalute the return value of do_something() such that I don't have to check for non-zero manually?</p>
  <p>Also, I cannot create a wrapper around do_something() such as</p>
  <pre><code>do_something = function() ffi.C.do_something() ~= 0 end
  </code></pre>
  <p>because the do_something ffi binding is automatically generated and doesn't know wether an integer return value is used as a boolean or an actual integer.</p>