lua-users home
lua-l archive

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


Hi,

I have developed a special network service for in-house use. All the details related to networking and serializing infrastructure are written in c++. Basically, in c++ I ensure the TCP connection, correctly receiving and sending messages, all the low level stuff. Now, I must give "power" to my server by embedding one scripting language to let the final users of my service write their own
applications.

In this context, an application is a bunch of functions that all the Lua scripts must have. This functions are called by the server. Much like implementing an abstract class. I see that working with Lua is very easy and straightforward. But I am interested in one particular thing: I want to be able to instantiate an object in Lua and keep it in c++. This object is like a session for the TCP connection that I'm handling. So, if a receive a network request, I unpak the request into meaningful c++ structure an pass this structure to Lua, along with the session above mentioned. This way, the guy that is writhing a Lua application for may server is able to keep his own custom state for his application.In c++ this session object is opaque.

So, the question is: Can Lua build such an opaque object and maintain it after lua_close(...)?



Thank you!

P.S.: I know I should read the docs and find the answer by myself, but I don't have the time to do it. Only thing I want is an yes or no and after that I will read the docs because I will need it.