Python - 调用Lua

本文介绍了如何在Python中使用Lupa库来调用Lua代码,包括Lua环境和LuaJIT的安装,以及Lupa的主要特点,如支持多线程和字符串编码解码。提供了Ubuntu14.04下Lupa的安装步骤和基本用法示例。
摘要由CSDN通过智能技术生成

Python 调用Lua

lupaLuaLuaJIT2集成进CPython,可以在Python中执行Lua代码.

Lupa的主要特点:
- separate Lua runtime states through a LuaRuntime class
- Python coroutine wrapper for Lua coroutines
- iteration support for Python objects in Lua and Lua objects in Python
- proper encoding and decoding of strings (configurable per runtime, UTF-8 by default)
- frees the GIL and supports threading in separate runtimes when calling into Lua解决了GIL问题,支持多线程
- tested with Python 2.6/3.2 and later 适用于Python 2.6/3.2以后的版本
- written for LuaJIT2 (tested with LuaJIT 2.0.2), but also works with the normal Lua interpreter (5.1 and 5.2)
- easy to hack on and extend as it is written in Cython, not C 扩展性好

1. lupa安装

这里基于Ubuntu14.04.
lupa官网提供的教程:

# ForDebian/Ubuntu + Lua 5.2
sudo apt-get install liblua5.2-dev  # Install Lua 5.2 development package
sudo pip install lupa  # Install lupa

<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值