Calling other languages from love2d?

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.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Calling other languages from love2d?

Post by raidho36 »

No I meant FFI, the thing that allows using C structs. If you use JIT alone, performance will be not quite as good - you'll have to use tables instead, and the abstraction level of those prevents deep optimization.

I did also mentioned hooking up compiled libraries, which is what you do if you're provided with one. But if you have to write them yourself then that defeats the purpose, doesn't it? You delegate the whole thing to a dll. What's the point of even using Lua then, if you're not actually using it?
MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

Re: Calling other languages from love2d?

Post by MasterLee »

raidho36 wrote: Fri Mar 24, 2017 7:07 pm You mean other than it's the language of choice of many major games and studios and vast multitude of smaller projects*, who are all citing speed, flexibility and ease of use as the reasons? Please.
There are many games written ECMAScript and derivatives.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Calling other languages from love2d?

Post by raidho36 »

You mean JS surely. That doesn't count - people who write web apps simply have no other choice, on account of JS bring the single supported language.
Skeletonxf
Citizen
Posts: 87
Joined: Tue Dec 30, 2014 6:07 pm

Re: Calling other languages from love2d?

Post by Skeletonxf »

Thanks for the help and for all the comments I guess.

I think I'm going to look into going Love2d/LuaJIT -> LuaJIT FFI -> C -> Haskell FFI -> Haskell if possible.

I imagine I should dive into using Haskell on its own first to actually learn it properly without being able to jump back to imperative code so it might be a while before I really get around to making a meaningful hybrid program, but I've got some ideas already.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Calling other languages from love2d?

Post by raidho36 »

Keep in mind that language is a tool to achieve your goal, but not the goal itself. If you want to write a game in Haskell, consider using a Haskell game framework.
MasterLee
Party member
Posts: 141
Joined: Tue Mar 07, 2017 4:03 pm
Contact:

Re: Calling other languages from love2d?

Post by MasterLee »

raidho36 wrote: Fri Mar 24, 2017 9:22 pm You mean JS surely. That doesn't count - people who write web apps simply have no other choice, on account of JS bring the single supported language.
Not only also ActionScript. There are tons of games written in Action Script sometimes converted into desktop games. And yes they had an choice but some started that stupid misery and many other jumped on. So it not every time best what is chosen by the masses.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Calling other languages from love2d?

Post by raidho36 »

MasterLee wrote: Sat Mar 25, 2017 1:30 pm Not only also ActionScript.
Kinda thought of it but being phased out, I omitted it. I suppose some methodology is to be addressed - if a separate framework used a language, that would count as a use instance, but not if a separete game made with that framework used its language. E.g. LOVE adds 1 point to the Lua use tally, but every LOVE game - doesn't. With that in mind, JS enjoys extremely narrow usage, with only a handful of runtimes supporting it altogether. Lua on the other hand is ubiquitous. World of Warcraft, Factorio, Roblox, you name it. Large array of non-games also use Lua for embedded scripting language, such as Rainmeter. These people had good reasons to choose Lua for scripting - can't be said for people who chose Javascript, let alone Action Script.
dixita
Prole
Posts: 5
Joined: Fri Mar 10, 2017 9:10 am

Re: Calling other languages from love2d?

Post by dixita »

MasterLee wrote: Fri Mar 24, 2017 9:11 am
raidho36 wrote: Fri Mar 24, 2017 4:45 am Lua is already the single best language for this type of job.
Source please
raidho36 wrote: Fri Mar 24, 2017 4:45 am It's the fastest, most flexible, and easiest to integrate into parent program, which in context of the LOVE framework have already been done for you. Some functionality may be available as a dynamic link library (aka shared object) and LuaJIT had the FFI to load those.
There are many shortcomings in Lua http://nekovm.org/lua

BY the way hsLua is an Lua Interpreter written in Haskell. So you can use Lua in Haskell as an scripting language.
For other language for example Red the is no sense in embedding Red in any other language or embedding any other languages in Red. Because you can do both sides in Red.
Thanx men.. now got it.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 32 guests