Clone a lua state

Posted by hbxfnzwpf on Stack Overflow See other posts from Stack Overflow or by hbxfnzwpf
Published on 2010-03-23T04:00:26Z Indexed on 2010/05/05 22:08 UTC
Read the original article Hit count: 206

Filed under:
|

Recently, I have encountered many difficulties when I was developing using C++ and Lua. My situation is: for some reason, there can be thousands of Lua-states in my C++ program. But these states should be same just after initialization. Of course, I can do luaL_loadlibs() and lua_loadfile() for each state, but that is pretty heavy(in fact, it takes a rather long time for me even just initial one state). So, I am wondering the following schema: What about keeping a separate Lua-state(the only state that has to be initialized) which is then cloned for other Lua-states, is that possible?

© Stack Overflow or respective owner

Related posts about lua

Related posts about state