lua-users home
lua-l archive

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


I don't think there is a good generic solution for this, since the structure of userdata isn't exposed to Lua. Maybe you could develop a nice marshaling layer that makes writing a to JSON function easier?

-Rob



mitch abaza <mitch.abaza@gmail.com> wrote:
My Lua code is calling a third party C++ library that returns userdata.  I need to serialize said userdata into JSON, which seems like a tricky proposition. If I can transform the userdata object into a table, then I can leverage existing lua packages to get my data into JSON.  Can anyone provide generic code that can transform userdata into tables?

-Mitch

--
Sent from Kaiten Mail. Please excuse my brevity.