OT: Lua questions

Brian Hook hook_l at pyrogon.com
Tue Jan 20 10:46:21 EST 2004


I'm using Lua (I think) in an unrelated project, and was wondering if 
y'all could provide some advice.

I have a database of users managed through SQL (note: I refuse to use 
LuaSQL since it's very poorly documented).  I have a C layer, the Lua 
layer, and then a set of MySQL databases.

I'm trying to figure out the right way to handle basic stuff like 
querying the MySQL db from Lua, etc.

Right now my inclination is that specific queries in Lua are handled 
by proxy through the C layer.  Oh, and I have a telnetd written in C.

So, er, the architecture is kind of like this:

C layer/network driver -> (received text) -> Lua
Lua -> (queries) -> C layer -> (queries) -> SQL db

Using a trivial example, someone telnets to my app and I have to 
verify their authenticity (yes, telnet is all cleartext, not a problem 
for now).  I accept() the connection for now, and then future data 
from that is automatically forwarded to the Lua subsystem, which in 
turn is responsible for prompts, etc. to the user and asking for their 
username, querying the MySQL user database for authenticity, etc.

Any suggestions for the "right" way to handle this?

This will eventually be expanded to handle things like items, etc. 
(this is a MUD, in case that wasn't apparent).

Brian





More information about the q2x mailing list