lua-users home
lua-l archive

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



Am 14.12.2012 um 12:34 schrieb Michal Kottman:

On 14 December 2012 12:16, Philipp Kraus <philipp.kraus@flashpixx.de> wrote:
On the C/C++ side I don't need any knowledge about the returned data, I must
store the data, and send them via MPI to the other hosts and the data is pushed
into the lua_pcall function

Perhaps one of the many table serialization libraries [1] will help you solve the problem - convert anything to a string representation, send the string, and deserialize the data on the receiving side before passing the data to Lua.


That's nice and seems to be a good trial, but do you know if I can serialize / desialize on the C side?
On a short view to the link, there are only Lua scripts to create the serialize / deserialize, but I would like
to do this not on the script side. 
I think I can write my own serialization, after the pcall is run I can run over the stack items and read them into
a C structure, but I have got a problem on table data eg
{ "key1" : 123, "key2" : "test123" }

In this case I have a table with a string key type and different value type, but on the C side
I can not convert this to a std::map or anything else, because the map need one fix key and value type
and without knowledge about the structure it is very difficult to find a generic serialization.

Do you think serialization on the Lua script is a better choice or do you think serialization on the C side is
better?

Thanks

Phil