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.

Source Distribution

lua_imports-1.0.0.tar.gz (2.0 kB view details)

Uploaded Source

Built Distribution

lua_imports-1.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file lua_imports-1.0.0.tar.gz.

File metadata

  • Download URL: lua_imports-1.0.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for lua_imports-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ce3e0d8333f2a3f8dc02cc39c41c7f8959a2215c95c1b2200ff6dfa435a21302
MD5 de0fbe5c4df0f426937df8f649a69e22
BLAKE2b-256 a127baa854d2e92557d71b7e8db94a3612705242f606d3e1db116a4cbe549b98

See more details on using hashes here.

File details

Details for the file lua_imports-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lua_imports-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for lua_imports-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be9e1c73c4faf3f8610ad894bb13e1090457afafb35b525f8ad3b7dd6e0ebabf
MD5 8f276c5ef8bcccb50880021b7345b410
BLAKE2b-256 b824353ef78e5fdc77fb4e7eede97812084dd4c54ce09caff915c1691c1ddc1b

See more details on using hashes here.

Supported by

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