Write and run Lua code directly from Python files.
Project description
LuaWrap
Write and run Lua code directly inside your Python files — no separate Lua install needed!
Installation
poetry add lupa
poetry install
Usage
from LuaWrap import lua, run_lua, lua_function, LuaBlock
# Run Lua directly
lua("print('Hello from Lua!')")
# Get a return value back in Python
result = run_lua("return 2 + 2")
print(result) # 4
# Decorator style
@lua_function
def my_script():
return "print('I am a Lua function!')"
my_script()
# Context manager style
with LuaBlock() as lb:
lb.code = "print('Runs when the block exits!')"
API
| Function | Description |
|---|---|
lua(code) |
Run a Lua string |
run_lua(code) |
Same as lua(), alias |
@lua_function |
Decorator — function returns Lua code as a string |
LuaBlock |
Context manager — set lb.code to your Lua string |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
luawrap-0.1.2.tar.gz
(2.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file luawrap-0.1.2.tar.gz.
File metadata
- Download URL: luawrap-0.1.2.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.14.3 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c732e087ef625e77443f9660e6bfe5dde9012586dbdc7896d178bc374b6ea4a
|
|
| MD5 |
55fb790aaa009d22be80f065a4c86486
|
|
| BLAKE2b-256 |
c10ad4def1a51e2f0872061ac8725b956758ecb885ca787eb3e238455e320efd
|
File details
Details for the file luawrap-0.1.2-py3-none-any.whl.
File metadata
- Download URL: luawrap-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.14.3 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c34fb34f08d1af3d3e1230467905be32178412a8436baa02ce693dff67170ac1
|
|
| MD5 |
40e350dc7eee9a418b617af457a95a15
|
|
| BLAKE2b-256 |
a6cf759d9a342fb7cf9f9f4f5f52bb7524bbefecc89b77de49ee5972753a947f
|