lupa icon indicating copy to clipboard operation
lupa copied to clipboard

how can pickle lua table

Open joijuke opened this issue 10 years ago • 2 comments

it's error when pickle.dumps(lupa.LuaRunTime().table(1,23)) how can pickle lua table??

joijuke avatar Apr 24 '15 11:04 joijuke

You currently can't. Shouldn't be difficult to implement, though. I take pull requests.

scoder avatar Apr 24 '15 16:04 scoder

The basic idea is to copy the data into a Python container (maybe a list of item tuples?) and pickle that. Anything that fails to pickle here (definitely any wrapped Lua objects) will simply make the pickling of the overall table fail. If every item can be converted to Python objects, the table will successfully pickle.

You may want to read up on the pickle protocol in the Python docs and how objects can implement it.

scoder avatar Apr 24 '15 16:04 scoder