Can you integrate Lua code in Ren'py scripts?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
Robin4000
Newbie
Posts: 3
Joined: Thu Oct 24, 2019 4:20 am
Contact:

Can you integrate Lua code in Ren'py scripts?

#1 Post by Robin4000 »

This might be a bit of an odd question,

but I have a friend who is a great programmer & likes to help me out with my game- The only thing is, that he codes in Lua.

Now, my question is; can I add his Lua code to my renpy scripts? ...without the player noticing anything of this, or getting other issues along the way.

To be more specific, he would code several mini-games - So, those are seperated parts from the main game. But the currency you earn there, CAN be spend in the the main game.

Well, if you have experience with this, then I love to hear about it :)

Kind regards

Robin

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#2 Post by isobellesophia »

Robin4000 wrote: Thu Oct 24, 2019 4:41 am This might be a bit of an odd question,

but I have a friend who is a great programmer & likes to help me out with my game- The only thing is, that he codes in Lua.

Now, my question is; can I add his Lua code to my renpy scripts? ...without the player noticing anything of this, or getting other issues along the way.

To be more specific, he would code several mini-games - So, those are seperated parts from the main game. But the currency you earn there, CAN be spend in the the main game.

Well, if you have experience with this, then I love to hear about it :)

Kind regards

Robin

First of all, RenPy uses Python. And thats all. If you want to make various mini games, you can learn it in Pygame and maybe import it in RenPy.


https://www.pygame.org/news

So RenPy and Pygame had the same codes, Python.
I am a friendly user, please respect and have a good day.


Image

Image


Robin4000
Newbie
Posts: 3
Joined: Thu Oct 24, 2019 4:20 am
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#3 Post by Robin4000 »

Thank you! But we actually want to avoid learning another code-language :)

So the question still remains...can I add his Lua code to my renpy scripts?

The thing that gave me the impression that it might be possible, was this post; viewtopic.php?f=32&t=33923&p=385416&hil ... 0libraries


Kind regards

Robin

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#4 Post by Donmai »

I believe that's a question for the "Development of Ren'Py" section viewforum.php?f=32.
Only PyTom himself can give a better answer related to the latest Ren'Py development state. Some things may have changed during the last four years.
Last edited by Donmai on Thu Oct 24, 2019 11:16 am, edited 1 time in total.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
isobellesophia
Miko-Class Veteran
Posts: 979
Joined: Mon Jan 07, 2019 2:55 am
Completed: None
Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
Organization: Friendly Teachers series
Deviantart: SophBelle
itch: Child Creation
Location: Philippines, Mindanao
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#5 Post by isobellesophia »

Asking PyTom should do, because he knows what RenPy can only use types of code languages.
Obviously only Python, and no one else. Putting that lua might be cause some errors in RenPy. As Donmai says, it is better to ask in that forum for future updates for RenPy.
I am a friendly user, please respect and have a good day.


Image

Image


User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#6 Post by Donmai »

Just for the record: "that Lua thing" is an outstanding scripting language used in many games like "Hungry Birds". Robin4000's question is really interesting.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#7 Post by rayminator »

this is what I get searching will lua code work with python
The lua module interfaces Python code to the Lua library, thus allowing Lua scripts to be run from Python. For most operations, a lua.lua object must be created. This object does all the work. Creating multiple lua objects from one Python program should work, but is untested.
best to test it your self because it is untested there is only way to find out is to try it

Pytom probably only can give you a 50 out of 100% answer

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#8 Post by Donmai »

Donmai wrote: Thu Oct 24, 2019 11:31 am Just for the record: "that Lua thing" is an outstanding scripting language used in many games like "Hungry Birds". Robin4000's question is really interesting.
Facepalm! Of course, you know, I meant ANGRY Birds. :lol:
But I guess most people here know that English is not my language. Oh my... :lol:
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

drKlauz
Veteran
Posts: 239
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#9 Post by drKlauz »

I guess using ctypes you could interact with lua lib (or anything else outside of python/renpy).
Biggest problem will be integrating RenPy graphics/audio systems with these lua minigames.
Overall it is really not worth it.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#10 Post by Remix »

You would need to write an abstraction layer (likely in Python) to interpret the Lua (or other language syntax) and then call/use the relevant Python or Ren'Py functions/classes/methods. In essence, you'd need to learn Python to do that and then do more work creating the interpreter than just continuing in Python and starting to learn some of the Ren'Py ways of doing things.
Ren'Py is, after all, a Python based DSL specifically aimed toward making VNs easily and having them built for a wide range of platforms (PC, Mac, web, tablet, mobile). It is not an API that you can easily expect to plug any language into without a good deal of work.

On an aside; even though Lua is a rather nice language, your friend would not go far wrong with starting to learn some Python - and Ren'Py is quite a nice visual way to start doing so.
Quietly mutters something about #1 programming language on the planet versus #20... (http://pypl.github.io/PYPL.html)
Frameworks & Scriptlets:

Robin4000
Newbie
Posts: 3
Joined: Thu Oct 24, 2019 4:20 am
Contact:

Re: Can you integrate Lua code in Ren'py scripts?

#11 Post by Robin4000 »

Hello & thanks everyone!

From your answers I understand that it's not really recommended to do this :)

To integrate lua with renpy seems a lot of hassle & that was actually what I was trying to avoid. So, I will just drop the idea, and start looking for some other wat to get this done.

Thank you all so much for your support!

Kind redards

Robin

Post Reply

Who is online

Users browsing this forum: Rhapsy