Lua programming language written in Python
Project description
mehtap
Lua 5.4 programming language implementation in Pure Python
Status
mehtap is in an early alpha stage. Since there is active development, API changes may happen without any special notice. Please pin your dependencies using a specific commit hash.
Installation
mehtap is supported on Python 3.10+. First, make sure you have a Python environment set up.
# in the shell
poetry add mehtap # if using python-poetry.org
pipenv install mehtap # if using pipenv.pypa.io
pip install mehtap # straight pip.pypa.io
What does mehtap have?
-
Everything in the Lua 5.4 grammar is supported.
-
There are utility functions to convert values from Python to Lua and from Lua to Python.
-
Most of the standard library is supported. (100% support is planned.)
Basic Functions (25/25)
-
assert() -
collectgarbage()— Does nothing. -
dofile() -
error() -
_G -
getmetatable() -
ipairs() -
load()— No binary chunks, no upvalues and no _ENV. -
loadfile()— seeload(). -
next() -
pairs() -
pcall() -
print() -
rawequal() -
rawget() -
rawlen() -
rawset() -
select() -
setmetatable() -
tonumber() -
tostring() -
type() -
_VERSION -
warn() -
xpcall()
Table Manipulation (7/7)
- [x] table.concat() - [x] table.insert() - [x] table.move() - [x] table.pack() - [x] table.remove() - [x] table.sort() — uses bubble sort... - [x] table.unpack()Input and Output Facilities (18/18)
- io.close()
- io.flush()
- io.input()
- io.lines()
- io.open()
- io.output()
- io.popen()
- io.read()
- io.tmpfile()
- io.type()
- io.write()
- file:close()
- file:flush()
- file:lines()
- file:read()
- file:seek()
- file:setvbuf() — Does nothing.
- file:write()
Operating System Facilities (11/11)
- os.clock()
- os.date()
- os.difftime()
- os.execute()
- os.exit()
- os.getenv()
- os.remove()
- os.rename()
- os.setlocale()
- os.time()
- os.tmpname()
-
What's the catch?
There are some differences with the specification of the reference manual. They are:
- garbage collection,
- frame scope.
For the most part, behaviour differences with the reference implementation are only allowed if the reference manual does not specify the behaviour. For example, the exact formatting of error messages is not specified in the reference manual, so it is allowed to be different.
Also, since this is a Python implementation, it is SLOW.
Acknowledgements
I want to hereby thank the following people for their
(uninformed) contributions to the project:
(If you are reading this, hello! 👋)
- Blake Bourque for creating Lua by Example, a great resource for learning Lua which also serves in the test suite of mehtap.
- oatmealine for putting together this awesome gist explaining how metamethods and metavalues override operations in detail.
Copyright (c) 2024-2025 Emre Özcan
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mehtap-0.2.0.tar.gz.
File metadata
- Download URL: mehtap-0.2.0.tar.gz
- Upload date:
- Size: 53.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c82d5300b2a096123e152aafc1bbbac71635dcebfedf61ea57603e168bd3c49a
|
|
| MD5 |
62ed4d1a4d03fec79701ae75c78a62be
|
|
| BLAKE2b-256 |
a37b77a1df5659320d37bb7528c83b078946a46f959ad57d124afd4a61521374
|
Provenance
The following attestation bundles were made for mehtap-0.2.0.tar.gz:
Publisher:
publish.yml on emreozcan/mehtap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehtap-0.2.0.tar.gz -
Subject digest:
c82d5300b2a096123e152aafc1bbbac71635dcebfedf61ea57603e168bd3c49a - Sigstore transparency entry: 220096262
- Sigstore integration time:
-
Permalink:
emreozcan/mehtap@7fb82e8840453712daf8fdded07f5ede8f664157 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/emreozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7fb82e8840453712daf8fdded07f5ede8f664157 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mehtap-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mehtap-0.2.0-py3-none-any.whl
- Upload date:
- Size: 60.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3d317915fe108ca332f20fc0f951dd35a24421d07f851d576a89d1be4f2be62
|
|
| MD5 |
fef4bac8ac1bd63c5393966b16cf79da
|
|
| BLAKE2b-256 |
4275275996dff863f5e2c00cc9d6b63f89172067314b1d0bee36dfe0a35d5831
|
Provenance
The following attestation bundles were made for mehtap-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on emreozcan/mehtap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mehtap-0.2.0-py3-none-any.whl -
Subject digest:
c3d317915fe108ca332f20fc0f951dd35a24421d07f851d576a89d1be4f2be62 - Sigstore transparency entry: 220096263
- Sigstore integration time:
-
Permalink:
emreozcan/mehtap@7fb82e8840453712daf8fdded07f5ede8f664157 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/emreozcan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7fb82e8840453712daf8fdded07f5ede8f664157 -
Trigger Event:
push
-
Statement type: