81 points · by scrollaway · 5y ago · 23 comments
Way back when I played minecraft, we used a mod called OpenComputers, which was basically a lua-based terminal inside minecraft. It had a package manager, python, and pastebin for managing code. It was really neat! Still think it's funny that it was Java -> Lua -> Python.
Ended up using that to "3d print" objects to make png murals using a python backend, some jad/sed/awk/grep, lua, and a python "frontend". The 3d printer allowed specifying color, but since you could also specify colors by x/y/z coords of other blocks, I decided to constrain the project to color definitions that way. Because masochism, probably. Wasn't easy, since block definitions were sometimes in java, hence jad. By FAR the jankiest project I've ever worked on, but damn did I learn a lot along the way, including some machine learning basics.
Posts like the OP's make fun projects like mine possible!
Fork https://github.com/bastibe/lunatic-python , with a commit in 2020, says:
> Sadly, Lunatic Python is very much outdated and won't work with either a current Python or Lua. [] This is an updated version of lunatic-python that works with Python 2.7-3.x and Lua 5.1-5.3 I tried contacting the original author of Lunatic Python, but got no response.
This fork has forks. https://pypi.org/project/lunatic-python-universal/ says:
> This package is a fork of the original from http://labix.org/lunatic-python, updated to support Python 3, and forked again from https://github.com/bastibe/lunatic-python to release to PyPi and support newer versions of Lua and macOS Homebrew-installed Lua.
http://lua-users.org/wiki/BindingCodeToLua also mentions https://pypi.org/project/lupa/ and https://pypi.org/project/ffilupa/ .
import browser
from browser import window
document = window.get_prop('document')
document_body = document.get_prop('body')
document_body.set_prop('textContent', browser.jsstr('hi'))
[0]: https://rustpython.github.io/demo/https://github.com/brython-dev/brython
I especially like the fact that I can have the same language in the backend and the front-end and it doesn't have to be JS, which I hate with passion.
My main beef with Lua is the absence of ‘null’, which means I can't write middleware doing transformations on data without a schema—i.e. API requests and processing, for which Lua would be great otherwise.
Lua’s equivalent is `nil` - I assume that doesn’t do what you need? How would the behaviour of `null` differ from Lua’s `nil`?
Actually, I can already see ways this is going to be good for Lua adoption on some of my projects, but also simultaneously threatening, since it means a 'more widely accepted language' could predispose continuing in Lua.
Actually, this is going to be very weird, once word gets out that Pythons batteries are up for grabs in certain circles ..