lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Jan 26, 2006, at 04:10, Jon Smirl wrote:

Has a change like this been considered for lua? I find the Ruby
solution much easier to work with.

Lua by itself doesn't know anything about sockets. LuaSocket, among others, provides this raw functionality. On top of LuaSocket it's usually beneficial to have some kind of run loop to simulate concurrent access. This is what those various dispatch layers do by scheduling coroutines to interact with the underlying sockets. Xavante uses its own copas mechanism. LuaSocket provides one as well in the form of dispatch.lua (under ../etc, check forward.lua for an usage example). And of course you can always write your own [1] if you are so inclined.

In other words, it's up to you to wrap LuaSocket in whatever way it's convenient :)

"Lua gives you the power; you build the mechanisms."
-- Roberto Ierusalimschy, "Programming in Lua", December 2003
http://www.lua.org/pil/12.1.2.html

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/

[1] http://dev.alt.textdrive.com/browser/lu/SocketRunLoop.lua