Skip to main content

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.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

luawrap-0.1.0-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file luawrap-0.1.0.tar.gz.

File metadata

  • Download URL: luawrap-0.1.0.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

Hashes for luawrap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3176cf77560b40ce2cfefc430005275f58f08d59ebd9e41737f2912fc105c2b0
MD5 af16cc9ad1830a7659ac8fa3fe90b4ef
BLAKE2b-256 f46d49ef100a3b62249d3f9a1d50f8bf0e3d969e271c2b402efec39adb02f300

See more details on using hashes here.

File details

Details for the file luawrap-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: luawrap-0.1.0-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

Hashes for luawrap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be6a5743edb07e75102b34f141b8396240519ce60414ebcacf64d2c1d8b87a0a
MD5 420f7b4ca1e6dae769c78bb32dd377b8
BLAKE2b-256 d9a737f7e7c23d3fca578bc82cb1b2738a7f23c642f1f13d9128aa6a350329de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page