Inherits from Object
Inherits from core.Handle
This module is for various classes and utilities that don't need their own module.
Inherits from core.Object
This class can be used directly whenever an event emitter is needed.
local emitter = Emitter:new()
emitter:on('foo', p)
emitter:emit('foo', 1, 2, 3)
Also it can easily be sub-classed.
local Custom = Emitter:extend()
local c = Custom:new()
c:on('bar', onBar)
Emit a named event to all listeners with optional data argument(s).
By default, and error events that are not listened for should thow errors
Adds an event listener (callback) for the named event name.
Same as Emitter:on except it de-registers itself after the first event.
Remove a listener so that it no longer catches events.
Utility that binds the named method self[name] for use as a callback. The
first argument (err) is re-routed to the "error" event instead.
local Joystick = Emitter:extend()
function Joystick:initialize(device)
self:wrap("onOpen")
FS.open(device, self.onOpen)
end
function Joystick:onOpen(fd)
-- and so forth
end
Inherits from core.Object
This is for code that wants structured error messages.
Inherits from core.Emitter
This class is never used directly, but is the inheritance chain of all libuv objects.
This is used by Emitters to register with native events when the first listener is added.
Wrapper around uv_close. Closes the underlying file descriptor of a handle.
Set or replace the handler for a native event. Usually Emitter:on() is what
you want, not this.
This is the most basic object in Luvit. It provides simple prototypal inheritance and inheritable constructors. All other objects inherit from this.
Create a new instance of this object
Creates a new sub-class.
local Square = Rectangle:extend()
function Square:initialize(w)
self.w = w
self.h = h
end
Creates a new instance and calls obj:initialize(...) if it exists.
local Rectangle = Object:extend()
function Rectangle:initialize(w, h)
self.w = w
self.h = h
end
function Rectangle:getArea()
return self.w * self.h
end
local rect = Rectangle:new(3, 4)
p(rect:getArea())
Inherits from core.Handle
This is never used directly. If you want to create a pure Lua stream, subclass
or instantiate core.iStream.
Inherits from core.Emitter
This is an abstract interface that works like core.Stream but doesn't actually
contain a uv struct (it's pure lua)
Inherits from core.Handle
TODO: Implement backpressure here and in tcp streams
Inherits from core.iStream
Inherits from core.iStream
allows duplicate headers. Returns the index it was inserted at
This sets a header, replacing any header with the same name (case insensitive)
Removes a set header. Cannot remove headers added with :addHeader
Inherits from core.Emitter
Inherits from core.Emitter
Inherits from Stream
querystring helpers
parse querystring into table. urldecode tokens
Build a composite stack made of several layers
Mounts a substack app at a url subtree
Inherits from Stream
Inherits from Handle
Inherits from Stream
Inherits from Handle