/PyLua

Source-to-source compiler that compiles Python into Lua

MIT LicenseMIT

Status: In development.

Information is chronologically added to this README.md file. When enough is implemented and fleshed out, then the library will be released.

PyLua - Python into Lua

PyLua is a source-to-source compiler that compiles Python into Lua.

PyLua is developed and tested using Python 3.5.1, Lua 5.1 and Lua 5.2.

Supported Functionality

The following list, is the features that currently can be successfully translated from Python to Lua.

Features in development has a strike-through.

  • Variables
  • Global & Local Variables (Differentiation)
  • Types
  • Operators
  • Functions
  • Nested Functions
  • Classes
  • Importing

Types

Supported Python types, that currently can be successfully translated from Python to Lua.

Example - Python (left), Lua (right)

Excluding functions.

Supported Python Types

Operators

Supported Python operators, that currently can be successfully translated from Python to Lua.

  • Arithmetic (+, -, *, /, %, **, //)
  • Comparison (==, !=, <>, >, <, >=, <=)
  • Assignment (=, +=, -=, *=, /=, %=, **=, //=)
  • Bitwise (~, &, |, ^, <<, >>)
  • Logical (not, and, or)
  • Membership (in, not in)
  • Identity (is, is not)

Example - Python (left), Lua (right)

Supported Python Operators

Functions

Supported Python function declarations, that currently can be successfully translated from Python to Lua.

Note that while Python supports multiple *args and **kwargs in function declarations, Lua does not. Lua doesn't as it represents varargs with ... (which is unnamed).

Example - Python (left), Lua (right)

Supported Python Function Declarations

License

This module is shared under the MIT license, and is therefore free to use, share, distribute and modify. See LICENSE for more details.