Build Love with Ruby instead of Lua

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Nightrains
Prole
Posts: 6
Joined: Sat Apr 25, 2020 7:58 am

Build Love with Ruby instead of Lua

Post by Nightrains » Sat Apr 25, 2020 8:20 am

Someone who knows how Love's source works so that instead of running Lua scripts, run Ruby, As far as I think I know, Love is written in C, and from C it compiles Lua and runs it (I think), I don't think I need to get rid of Lua completely, just add Ruby support. I need ideas or some explanation of how I can achieve this.

I have already seen the Love source code and I also know how to build it, my idea so far is to implement the Ruby interpreter and replace some functions of the Lua interpreter with Ruby.

Or maybe execute Ruby from Love without needing to recompile it?

I want to use Ruby in Love because it seems as simple as Lua and it has many similarities, but with more functions, such as classes for example. (And many other reasons)
Last edited by Nightrains on Sat Apr 25, 2020 3:52 pm, edited 2 times in total.

User avatar
Varkas
Citizen
Posts: 54
Joined: Mon Mar 09, 2020 2:26 pm

Re: Build Love with Ruby instead of Lua

Post by Varkas » Sat Apr 25, 2020 2:41 pm

Good luck! While it certainly is possible to create all the library bindings for Ruby which Love2d offers for Lua, I don't understand the motivation except that someone likes Ruby more than Lua?

You can have something like classes in Lua if you want to. "Ruby has classes" is not a very strong argument against Lua.
In soviet russia, code debugs you.

Nightrains
Prole
Posts: 6
Joined: Sat Apr 25, 2020 7:58 am

Re: Build Love with Ruby instead of Lua

Post by Nightrains » Sat Apr 25, 2020 3:25 pm

Varkas wrote:
Sat Apr 25, 2020 2:41 pm
Good luck! While it certainly is possible to create all the library bindings for Ruby which Love2d offers for Lua, I don't understand the motivation except that someone likes Ruby more than Lua?

You can have something like classes in Lua if you want to. "Ruby has classes" is not a very strong argument against Lua.
It is not only that, I want to dedicate myself to creating a game with Love but I need a really good good language for that (Create games), Ruby is one of those, but Lua is a Language although fast and light, very basic.

Xugro
Citizen
Posts: 69
Joined: Wed Sep 29, 2010 8:14 pm

Re: Build Love with Ruby instead of Lua

Post by Xugro » Sat Apr 25, 2020 3:34 pm

You could use something like RLua which bind Lua und Ruby together:
RLua is Ruby to Lua bindings library that features nearly complete coverage of Lua C API, seamless translation of Lua and Ruby objects into each other, calling Lua functions from Ruby and vice versa.

Nightrains
Prole
Posts: 6
Joined: Sat Apr 25, 2020 7:58 am

Re: Build Love with Ruby instead of Lua

Post by Nightrains » Sat Apr 25, 2020 4:12 pm

Xugro wrote:
Sat Apr 25, 2020 3:34 pm
You could use something like RLua which bind Lua und Ruby together:
RLua is Ruby to Lua bindings library that features nearly complete coverage of Lua C API, seamless translation of Lua and Ruby objects into each other, calling Lua functions from Ruby and vice versa.
You know how to use it? I am searching but I don't know if it could be run directly from Lua, otherwise it is not possible.

MrFariator
Party member
Posts: 153
Joined: Wed Oct 05, 2016 11:53 am

Re: Build Love with Ruby instead of Lua

Post by MrFariator » Sat Apr 25, 2020 5:27 pm

Besides classes (which can be done with lua) what do you need that lua doesn't offer but ruby does?

Nightrains
Prole
Posts: 6
Joined: Sat Apr 25, 2020 7:58 am

Re: Build Love with Ruby instead of Lua

Post by Nightrains » Sat Apr 25, 2020 8:05 pm

MrFariator wrote:
Sat Apr 25, 2020 5:27 pm
Besides classes (which can be done with lua) what do you need that lua doesn't offer but ruby does?
I have used Lua for a long time, I want to use something new, but still using Love, and what I would like to try is Ruby or Python, but right now I only want to be able to use Ruby.

Ruby in addition to classes has a more elegant and simple syntax, but similar to that of Lua, switch cases, operators like +=, -=, etc.

sphyrth
Party member
Posts: 160
Joined: Mon Jul 07, 2014 11:04 am
Contact:

Re: Build Love with Ruby instead of Lua

Post by sphyrth » Sat Apr 25, 2020 11:28 pm

MrFariator wrote:
Sat Apr 25, 2020 5:27 pm
Besides classes (which can be done with lua) what do you need that lua doesn't offer but ruby does?
Ruby can do this:

Code: Select all

1:destroy_number(2)

Code: Select all

false:become_true()
I consider that Ruby's "Everything is a class... even variables" to be the it's most powerful attribute as a Programming Language. I don't know about other languages using this principle, but Ruby introduced me to such a beautiful concept.

User avatar
zorg
Party member
Posts: 2914
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Build Love with Ruby instead of Lua

Post by zorg » Sun Apr 26, 2020 12:44 am

And lua's concept may very well be: "you only need tables as /the/ aggregate type" and i'm sure others can list similar whimsical one-liners for other languages like perl or whatever. :3

So, Löve is written in C++, and it uses LuaJIT by default to execute lua code as fast as if it were near native C code. It does not use the PuC or any other lua interpreters by default. If you do manage to recompile it somehow with a Ruby interpreter instead of LuaJIT, you will feel the godawful slowdown that will result in.

Lua's a good enough language for doing anything in it, like any other; the list of commercially released Löve games on steam is a telling supportive argument to that.
And you can implement classes in lua, there's already like 50 implementations. Along with literally anything else. Lua is basic, yes, but also flexible.






That said, if you really want to write a ruby interpreter, whether to replace LuaJIT or even just in lua, that's up to you and is in fact a more gargantuan task than if you just started coding your game at this moment. :monocle:
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

MrFariator
Party member
Posts: 153
Joined: Wed Oct 05, 2016 11:53 am

Re: Build Love with Ruby instead of Lua

Post by MrFariator » Sun Apr 26, 2020 1:18 am

sphyrth wrote:
Sat Apr 25, 2020 11:28 pm
I consider that Ruby's "Everything is a class... even variables" to be the it's most powerful attribute as a Programming Language. I don't know about other languages using this principle, but Ruby introduced me to such a beautiful concept.
I am aware of this quirk of ruby's, and it's an interesting one. It's not too dissimilar from lua's table shenanigans, just taken a step further ahead.
Nightrains wrote:
Sat Apr 25, 2020 8:05 pm
I have used Lua for a long time, I want to use something new, but still using Love, and what I would like to try is Ruby or Python, but right now I only want to be able to use Ruby.
I was wondering if there was something about ruby that made you want to use it over lua, and I guess I can't fault you for wanting to learn something new. You were curious about the how, while I was simply curious about the why.

Instead of cramming either ruby or python into löve though, I'd instead rather suggest looking into libraries or frameworks specifically made for either of those two languages. I'm not sure if ruby has its equivalent of löve (in terms of available features and maturity), but even a simple framework would at least allow you start writing a game now rather than later.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests