LuaWrap
Write and run Lua code directly inside your Python files — no separate Lua install needed.
Installation
pip install LuaWrap
How to Use
All your Lua code goes inside a string passed to lua(). Use triple quotes """ to write
multiple lines, just like a normal Lua script:
from LuaWrap import lua
lua("""
local var1 = 10
local var2 = 20
print("The sum of var1 and var2 is: " .. (var1 + var2))
""")
That's the main way to use LuaWrap! Write as many lines of Lua as you want inside the quotes.
Important: Do NOT write Lua code directly in the Python file — it must always be inside a string passed to
lua(). Pylance will show errors if you write Lua outside of strings.
More Ways to Use It
Get a value back in Python:
from LuaWrap import run_lua
result = run_lua("return 2 + 2")
print(result) # 4
Reusable Lua functions with @lua_function:
from LuaWrap import lua_function
@lua_function
def say_hello():
return """
local name = "World"
print("Hello, " .. name .. "!")
"""
say_hello() # call it like a normal Python function
Block style with LuaBlock:
from LuaWrap import LuaBlock
with LuaBlock() as lb:
lb.code = """
for i = 1, 5 do
print("Number: " .. i)
end
"""
# Lua runs automatically when the block ends
API
| Tool | What it does |
|---|---|
lua("...") |
Run Lua code from a string — the main way to use LuaWrap |
run_lua("...") |
Same as lua(), but also returns the result to Python |
@lua_function |
Decorator — wrap a Python function that returns Lua code as a string |
LuaBlock |
Context manager — set lb.code to your Lua string, runs on exit |
WARNING:
This is not tested completely, bugs might appear.
Metadata
Release files for LuaWrap 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| luawrap-0.1.6.tar.gz | 2.6 kB | Without provenance | Details for luawrap-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| luawrap-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for luawrap-0.1.6-py3-none-any.whl |
Total release size: 5.8 kB
Release files / luawrap-0.1.6.tar.gz
| Download URL | luawrap-0.1.6.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58ab6cb373a3ea1ac3cf5c5a0027be04099f132a267b05e6c957918d572ac944
|
|
BLAKE2b-256 checksum How to use checksums |
077a98032d8e8ac95467a9bf39dc18b6ae469a896aa53348c36e6b81bc074094
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.3 Windows/11
|
Release files / luawrap-0.1.6-py3-none-any.whl
| Download URL | luawrap-0.1.6-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
441b02dd2dee37fe755a45d6a14955560b0602d945a4309ed2a6271f0c6f7657
|
|
BLAKE2b-256 checksum How to use checksums |
2927007efe5dc9f50bd6b765de7ede47742e2738009d12171373d05fa757a54b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.3 Windows/11
|
Security for LuaWrap 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.