lua-users home
lua-l archive

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

On Thursday 17 August 2006 12:53 pm, Thomas Blom wrote:
> 2. I lease or maintain a dedicated linux server, on which I install LUA,
> and write the server app in Lua, making use of luasocket and luasql or
> equivalent.  Client network IO handled as in (1).  (Will I need to write a
> C app, embed lua, or can I write the whole app in Lua?)

you can certainly write the whole app in lua.  the only executable in that 
case would be the included 'lua' command.  the Xavante web server runs this 

most Linux distributions have Lua packages available, but these are usually 
5.0.2, not all have 5.1 available yet.  the other modules, LuaSocket and 
LuaSQL are less likely to be available as packages.  therefore it might be 
easier to build your own package with both Lua and any extra packages.

Also, for servers you would have to do some multitasking.

A pure Lua solution is the Copas package (again, it's the one used in 
Xavante), but there are other ways to do it.

maybe the easiest one is to use the inetd 'superserver' included in almost all 
Unix-like systems.  it simply listens on network sockets and runs a new 
process for each client connection.  in this case you don't even need 
LuaSocket, because the inetd server simply sets up the standart in/out ports 
to the TCP connection.

a slight variation (one that i plan to use for specialized servers) is the 
ucspi-tcp package.  it does rougly the same thing, but taking the unix 
philosophy of "one simple tool for each simple task, connected in complex 
ways" to the extreme.  not easy to swallow, but gives a great peace of mind 
about stability.

but, in the end, when i can't control what to install on a server, i mostly 
use what's already available, usually bash/Perl for offline tasks, and PHP 
for web.  not that i'm happy to use them... but they get the work done with a 
minimum of troubles.  nowadays Python is almost as available as Perl, but i 
find it even uglier than Perl (i didn't think that was possible!)


Attachment: pgpPdpuU3d4kF.pgp
Description: PGP signature