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.1.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.1.tar.gz.
File metadata
- Download URL: luawrap-0.1.1.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 |
6b18dac3bc63c15bed4ee52310480e594b6db05f7f56134a396e0266769e0b92
|
|
| MD5 |
98372088ee2e44d8750babb14747d5c9
|
|
| BLAKE2b-256 |
763c520625185cda90aa6b7d8ca0d53aec223412295e012a5224b24e1c4af26f
|
File details
Details for the file luawrap-0.1.1-py3-none-any.whl.
File metadata
- Download URL: luawrap-0.1.1-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 |
fbc2851795875816c75fb5ece59545e57dec5aa0686fff0c948c7d936cc7ac86
|
|
| MD5 |
ccc59beb29dab7b1ee64a3a236d58885
|
|
| BLAKE2b-256 |
f3888bdb55a0583f99c9857640510b645edcc1d5bf807aa9010708401fb00cef
|