I need to send a lua_state to a server using Sockets in C ++. How I can serialize a lua_State so that it can be sent over the network?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Depending on your needs, you have several choices. You can try to use the Pluto Library. It is a “heavy-weight” serialization library:
You may also try lper, which uses Linux Persistent Memory.
Note that you will have problems with sending custom C functions and userdata…
If you actually do not need to send entire
lua_State(why would you need that?), you can take a look at the TableSerialization page at the Lua-users Wiki. Maybe you can solve your problem by sending serialized (possibly large) Lua tables containing the entire “state” you need.