Echo server: Difference between revisions

m
Tidied Lua explanation
m (Added further explanation)
m (Tidied Lua explanation)
Line 1,168:
=={{header|Lua}}==
{{libheader|LuaSocket}}
This implementation doesn't rely on coroutines because they're an additional (often confusing) notion that could make the example needlessly hard to understand. Instead I'veit useduses a table of not-quite-non-blocking socketssocket client objects (they block for one microsecond), which Iis loopiterated through,over to checkingcheck on whether each one has either a line to echo or an error to warrant deletion.
<lang Lua>require("socket")
 
Line 1,183:
return err
end
return falsenil
end
 
Anonymous user