lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>This seems like something that should be done by hand by someone who
>>knows both languages.
>It's really a bad news. I really hope to automatically achieve this goal.

It's unlikely there is a way to do this automatically. If you really
want a script that does most of the work, you can look into converting
your Python script into an AST structure
(https://docs.python.org/3/library/ast.html) and then convert it back
into Lua using metalua
(https://github.com/fab13n/metalua/blob/master/doc/ast.txt).

There is a python modules that solves the opposite problem (builds a
Python AST from Lua code): https://pypi.org/project/luaparser/, so
maybe you can review it to see how it was done.

> I find an open source project(i.e
> https://github.com/dmitrii-eremin/python-lua) which may achieve this
> goal, but it seems not been maintained anymore since 2017.

Why does it matter that it's not maintained anymore? Judging by the
description it does just what you need.

Paul.

On Thu, Jan 28, 2021 at 10:52 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
>
> Thank you for your reply.
> >This seems like something that should be done by hand by someone who
> >knows both languages.
> It's really a bad news. I really hope to automatically achieve this goal.
>
> On Fri, Jan 29, 2021 at 2:44 PM Robert Burke <sharpobject@gmail.com> wrote:
> >
> > Hello,
> >
> > This seems like something that should be done by hand by someone who
> > knows both languages.
> >
> > On Fri, Jan 29, 2021 at 12:29 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> > >
> > > Hi, list
> > >
> > > Is it possible to perfectly convert the Python script to Lua script?
> > > The script that contains peripheral operations is not to be considered.
> > >
> > > I find an open source project(i.e
> > > https://github.com/dmitrii-eremin/python-lua) which may achieve this
> > > goal, but it seems not been maintained anymore since 2017.
> > >
> > >
> > > Best regards
> > > sunshilong