-
-
Notifications
You must be signed in to change notification settings - Fork 143
Open
Description
Hello,
Sorry for the noob question, but I can't quite figure it out.
I'm trying to use the Python JSON lib instead of any of the lua ones due to issues with package installation on target, but I can't get even the minimal example to work. Here's what I'm trying:
import lupa
import json
lua = lupa.LuaRuntime(unpack_returned_tuples=True)
lua.execute("json = {}")
lua.globals()["json"]["encode"] = json.dumps
lua.globals()["json"]["decode"] = json.loads
lua_function = """
function construct_json_list()
local out = {"a", "b", "c"}
return json.encode("throwaway", out)
end
"""
lua.execute(lua_function)
print(lua.globals()["construct_json_list"]())This simply throws TypeError: Object of type _LuaTable is not JSON serializable. Obviously json.dumps does not support Lua Tables.
tl;dr how to convert a lua table to a python object?
Any help is appreciated.
Metadata
Metadata
Assignees
Labels
No labels