Skip to main content

Import Lua modules directly from within Python

Project description

lua_imports

Import Lua modules directly from within Python.

Basic Usage

Once lua_imports.lua_importer has been registered, write an import statement in your Python code, referring to your Lua module.

Example

foo.lua

return {
    say_hello = function(person)
        print("Hello, " .. person)
    end
}

bar.py

import foo

foo.say_hello("World")

Registration

lua_importer may be registered within Python code:

from lua_imports import lua_importer

lua_importer.register()

(Note that this must come before any Lua imports)

Alternatively, to register lua_importer environment-wide, create a lua-imports.pth file in your environment's site-packages folder with the following contents:

import lua_imports; lua_imports.lua_importer.register()

Caveats

This module wraps Lupa, and so comes with all the same caveats about Lua vs. Python data types.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for lua-imports, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size lua_imports-1.0.0-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size lua_imports-1.0.0.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page