将 .lua 文件中的值访问到 python

Access values from .lua file into python

我对 LUA 了解不多,但我有这个非常大的 .lua 文件,它看起来像这样:

return {
  ["Aatrox"] = {
    ["id"]         = 266,
    ["apiname"]    = "Aatrox",
    ["title"]      = "the Darkin Blade",
    ["attack"]     = 8,
    ["defense"]    = 4,

...

文件只是returns这个非常大的对象。我的问题是:我如何访问我的 Python 脚本中的 Aatrox 防御值(即 4)?别着急,我是 lua 的新手,我的术语不是很好。

我将 lua 对象转换为 json 文件,以便能够在 @Egor Skriptunoff 的评论帮助下从 python 访问它:

There are a lot of Lua JSON libraries. Even me has one. Use a text editor to convert your file return {big_object} into print(require"json".encode{big_object}) and run it in Lua interpreter. The json.lua file must be in subfolder lua (for example, you may have C:\Lua\lua.exe, C:\Lua\lua5x.dll and C:\Lua\lua\json.lua)