如何将 Lua 和 Python 集成

我正在为我父亲的杂货店制作一个数据库管理系统,我希望将账单发送到客户的手机上。因此,我想让 Lua 处理应用程序界面,Python 处理 Solar 2d 中的所有后端工作。但我不知道如何将它们结合起来,以便它们能够相互配合,而不需要在每个会话中启动 Python 解释器。 以下是伪代码

--lua 代码
local py = require("python") -- 这里我导入了我的 Python 模块
local my_file = require("my python file")

py.my_file.some_function("some Value")

# 然后在 Python 中,脚本运行后它将执行 Python 代码
import my_lua_file_output

def some_function(someValue): # 这是与上述 Lua 脚本中使用的相同函数
    我的代码

谢谢。

点赞