lua-users home
lua-l archive

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


Hi,
 
I'm currently working for a small project where our c++ application periodically pulls handful amount of data from server and manipulate them into several types of statistical chart. Customer very often request me to add a new types of statistical data, and I finally decided to use lua for generating such statistical data without touching core c++ application.
 
After quite a mount of time spending in learing lua, and I finally prototyped so that c++ application now utilize several lua scripts and each of them generates its unique statistical data.  There is a glue class which own its lua_State handle as a member, and adding and using a new lua script instantiates another glue class instance. The lua scripts conatins several event handlers(i.e. OnConnectedServer, OnReceiveNewData, OnCloseServer) and its own local variables for caching history data etc. 
 
The problem is that, for the each lua script to generate such statistical data, c++ application pushes its own internal data into lua table of a ceratin lua_State as many as the number of the glue class instances, and I feel something smells bad on this point. 
 
Question 1: Is there any way of sharing table data between different lua_State ?
Question 2: I'd love to use only on lua_State and push data once into table on that lua_State still running many lua scripts on this lua_State. Is this possibe?  I'd be appreciate if anyone points me a good example source or link .
 
 
--

Joon