Metadata-Version: 2.4
Name: luawrap
Version: 0.1.3
Summary: Write and run Lua code directly from Python files.
License: LicenseRef-LuaWrap-Custom
Author: Your Name V011DZ
Requires-Python: >=3.8,<4.0
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: lupa (>=2.0,<3.0)
Description-Content-Type: text/markdown

# LuaWrap

Write and run Lua code directly inside your Python files — no separate Lua install needed.

## Installation

```bash
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:

```python
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:**
```python
from LuaWrap import run_lua

result = run_lua("return 2 + 2")
print(result)  # 4
```

**Reusable Lua functions with `@lua_function`:**
```python
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`:**
```python
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 |
