Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How is this different from https://github.com/luvit/luv (part of http://luvit.io/)?


In addition to what benjaminva said, luv uses callbacks (like Node.js), whereas this uses coroutines. So for example with luv you might do something like:

    fs.readFile(filename, function(err, data)
      -- remember to check err
    end)
With this binding the code would look like:

    local data = fs.readfile(filename)
    -- err was raised if one occurred
With coroutines, you can use exceptions and for/while loops and they continue to work as you would expect.


luv is a lua bindung for the libuv library which means that it uses all the C API provided by the lua language to code the interface between C functions and lua functions.

Here we have a FFI-binding which means that only the header of the C functions are sufficient for the ffi library to handle all conversions of variables to and from the lua environment. Additional interface related functions are coded in lua instead of C.

Luajit provides a powerful FFI implementation which makes it very easy to provide interfaces to C libraries. However, it is not part of the vanilla lua implementation which is why both versions have their reasons to exist.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: