lua-users home
lua-l archive

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


On 14 December 2012 12:50, Philipp Kraus <philipp.kraus@flashpixx.de> wrote:
That's nice and seems to be a good trial, but do you know if I can serialize / desialize on the C side?

Some libraries also have C API for serialization, like lua-bins [1], so you can call the serialization from C, not from Lua.

[1] https://github.com/agladysh/luabins

int luabins_save(lua_State * L, int index_from, int index_to);
int luabins_load(lua_State * L, const unsigned char * data, size_t len, int *count);

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

If you want transparency (the Lua users do not need to be aware of the implementation details), IMHO it is better to do the serialization in C. This way, the Lua script looks like everything is happening on the same host, while on the background, data is being transferred elsewhere.