Lua parameter in python

I am learning about using Lua in a web project. I can't find a way to parse directly in pure python and run Lua code in Python.

Does anyone know how to do this?

Joe

+2


a source to share


3 answers


Here is this project ( pylux ) that embeds Lua in Python. It seems rather inactive though, but it might be a good project to look at.



0


a source


From your comments, it looks like you are interested in a safe way to execute untrusted code.

Updating python builtins, as you said in a comment, is a terrible way to protect your code.



What you want is sandboxing, there are python solutions, but I would not recommend them. You would be much better off using Jython or IronPython because the JVM and .NET clr were designed with a sandbox in mind.

I personally believe that in most cases, if you need to execute untrusted code, you bet too much or not trust your users enough.

+2


a source


@the_drow

From the Lua website:

Lua is a fast, small size language engine that you can embed easily into your application. Lua has a simple and well-documented API that allows strong integration with code written in other languages. Easily extend Lua with libraries written in other languages. It is also easy to extend programs written in other languages ​​using Lua. Lua is used to extend programs written not only in C and C ++, but also in Java, C #, Smalltalk, Fortran, Ada, Erlang, and even other scripting languages ​​such as Perl and Ruby.

@ Joe Simpson

Check out Lunatic Python, it may have what you want. I know this is an old question, but other people may find this answer too. This is a good question and deserves a good answer.

+1


a source







All Articles