Jump to content
  • Advertisement
Sign in to follow this  
Kylotan

LunaticPython - Lua + Python!

This topic is 5035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Why argue over which one to use, when you can use both? ;) http://moin.conectiva.com.br/LunaticPython
"2. Introduction Lunatic Python is a two-way bridge between Python and Lua, allowing these languages to intercommunicate. Being two-way means that it allows Lua inside Python, Python inside Lua, Lua inside Python inside Lua, Python inside Lua inside Python, and so on. 3. Why? Right now this is an experiment. Let me know if you find some real usage for it."
Example from that page:
>>> import lua
>>> lg = lua.globals()
>>> lg.string
<Lua table at 0x81c6a10>
>>> lg.string.lower
<Lua function at 0x81c6b30>
>>> lg.string.lower("Hello world!")
'hello world!'

>>> d = {}
>>> lg.d = d
>>> lua.execute("d['key'] = 'value'")
>>> d
{'key': 'value'}

>>> d2 = lua.eval("d")
>>> d is d2
True

>>> lua.eval("python")
<Lua table at 0x81c7540>

>>> class MyClass: pass
... 
>>> obj = MyClass()
>>> obj
<__main__.MyClass instance at 0x403ccb4c>
>>> lua.eval(r"python.eval('lua.eval(\"python.eval(\'obj\')\")')")
<__main__.MyClass instance at 0x403ccb4c>


I think that last line alone should be enough. ;)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
I may not have to hate Blender3D with a fiery passion from now on!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!