Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on May 5, 2013
Commits on May 4, 2013
  1. Replace lua_setfenv() and lua_getfenv() with Lua 5.2

    lua_setuservalue() and lua_getuservalue() and add backwards
    compatibility shims for 5.1.
  2. update for lua 5.2

    Poggles authored committed
Commits on Oct 7, 2010
  1. @bdowning

    lua-ev: Simplify watcher auto-stop

    bdowning authored committed
    This removes special-purpose code and should make implementing ev_periodic
    and any other watcher types that auto-stop easier.
Commits on Sep 6, 2010
  1. Integrate Brian Downing's changes in, making the following

    Brian Maher authored
     * Change the implementation of the "shadow" user data so that only
       users of this functionality pay for the extra overhead of a lua
       table for every watcher.
     * Simplify how a watcher is "checked" so that it simply looks for
       a magic key in the metatable to determine if it is of the right
     * Require libev 3.7 (print a warning if this version is not
       satisfied).  This version is required in order to set userdata on
       an event loop.
     * Instead of having a separate watcher metatable, simply mix-in the
       watcher metatable methods.
     * Add note about calling ev_loop() directly from C.
    TODO: Is the loop specific shadow user data desired?  If not, then
    the obj_index and obj_newindex should be renamed watcher_index and
Commits on Aug 28, 2010
  1. @bdowning

    Support priority setting for watchers

    bdowning authored
    This is just a simple implementation of ev_priority/ev_set_priority.
    ev.MINPRI and ev.MAXPRI are also exported.
  2. @bdowning

    Use lua_State from loop:loop() call site, not watcher creation

    bdowning authored
    The lua_State for running callbacks used to be stored in a thread-local
    variable initialized when loop:loop() was called.  At some point this
    changed to be a lua_State that is stored (in watcher->data) when a
    watcher is created.  This is almost always the wrong thing in an
    environment with coroutines.
    Instead, abuse the userdata slot in the loop object for this.  Save
    off the old userdata before calling ev_loop(), set it to L, run ev_loop(),
    then restore it.  This gets roughly the same effect as the old code
    without requiring any pthreads nastiness, since if you're running the
    same loop from two different threads at the same time you've already
    got a problem.
  3. @bdowning

    Clean up lua-ev warnings

    bdowning authored
  4. @bdowning

    Create WATCHER_MT, abstract out common code

    bdowning authored
    This creates a common WATCHER_MT metatable that all the different
    watcher types have in their ancestry.  This allows us to eliminate a
    fair amount of common code in each watcher type's implementation.
  5. @bdowning

    Add support for storing arbitrary values in lua-ev objects

    bdowning authored
    One thing missing from lua-ev that is present in "raw" libev is being
    able to associate arbitrary user data with loops and watchers.  In Lua
    this can be worked around by using closures or object-keyed tables,
    but this can sometimes be inconvenient.
    This patch modifies the metatable arrangement of lua-ev objects to allow
    for storing arbitrary data.  Rather than simply:
        setmetatable(obj, luaL_getmetatable("tname"))
    we do:
        class = luaL_getmetatable("tname")
        shadow = setmetatable({ }, class)
        fenv = { __gc = class.__gc, __index = shadow, __newindex = shadow }
        setfenv(obj, fenv)
        setmetatable(obj, fenv)
    This only costs one extra table per object, since every object already
    had an fenv used in a way compatible with the above.  Also, since the
    shadow table isn't the metatable, setting arbitrary parameters won't do
    anything unexpected (like killing the __gc method for a loop).
    This results in a very easy and intuitive method of storing userdata in
    libev objects - basically, they can just be treated as tables.
Commits on Feb 15, 2010
Commits on Feb 13, 2010
Something went wrong with that request. Please try again.