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 » 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

User avatar
isobellesophia
Miko-Class Veteran
Posts: 692
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

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

#2 Post by isobellesophia » Thu Oct 24, 2019 5:44 am

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..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
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 » Thu Oct 24, 2019 10:41 am

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: 1853
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
Projects: Slumberland
Location: Brazil
Contact:

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

#4 Post by Donmai » Thu Oct 24, 2019 11:06 am

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: 692
Joined: Mon Jan 07, 2019 2:55 am
Projects: Maddox's Everyday Talk! (13+ Unreal version), Maddox Everyday Talk! (3+ Real-Friendly version)(Upcoming 2020)
Organization: Friendly Teachers series
itch: .......
Location: Philippines, Mindanao
Contact:

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

#5 Post by isobellesophia » Thu Oct 24, 2019 11:10 am

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..


Working on a talking simulation game for everyone, except children.

Maddox Everyday Talk!
Is my very very main project, not contain 13 below.

Main project here viewtopic.php?f=43&t=56564
Image

User avatar
Donmai
Eileen-Class Veteran
Posts: 1853
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
Projects: Slumberland
Location: Brazil
Contact:

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

#6 Post by Donmai » 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.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
rayminator
Veteran
Posts: 269
Joined: Fri Feb 09, 2018 12:05 am
Projects: Redoing games to fix spelling mistakes other companys that don't care
Location: Canada
Contact:

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

#7 Post by rayminator » Thu Oct 24, 2019 1:21 pm

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: 1853
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
Projects: Slumberland
Location: Brazil
Contact:

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

#8 Post by Donmai » Thu Oct 24, 2019 1:48 pm

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
Regular
Posts: 166
Joined: Mon Oct 12, 2015 3:04 pm
Contact:

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

#9 Post by drKlauz » Thu Oct 24, 2019 2:21 pm

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.

User avatar
Remix
Eileen-Class Veteran
Posts: 1311
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 » Thu Oct 24, 2019 8:30 pm

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)
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Develop Cartoon Speech Bubble dialogue
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

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 » Sat Oct 26, 2019 5:02 am

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: Bing [Bot], Google [Bot]