Whats Love 2d exactly ?

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.
Post Reply
-Bangester-
Prole
Posts: 21
Joined: Tue Mar 07, 2023 11:01 pm

Whats Love 2d exactly ?

Post by -Bangester- »

So I'm Really Confused, I know there are two things called Lua And Love2D but what's the difference? And Does Love 2d use a different language than Lua?? Because when I code i use code syntax that includes Love in it, so if I want to switch will I need to learn a new language ???

conclusion: WHAT IS THE DIFFERENCE BETWEEN THEM AND WHAT IS LOVE 2D USED FOR ? (I'm not screaming)
MrFariator
Party member
Posts: 525
Joined: Wed Oct 05, 2016 11:53 am

Re: Whats Love 2d exactly ?

Post by MrFariator »

Love2d is a framework (or engine), that wraps up libraries like SDL, OpenAL, Box2d, and bunch of others into one package. The purpose of this is to make your life easier, in that it essentially provides a box of tools for you to use - rather than asking you to implement everything yourself (graphics, audio, input handling, etc). However, this implementation is written in C++, while the actual scripting interface that you use with love2d offers lua. Lua is a simpler language than C++, and it is often used by game engines for scripting or mod support.

So in short, when making your project in love2d, you write your code in lua. Lua is a scripting language. Lua tells love2d what to do. Love2d, the engine, handles the rest of the nitty gritty details under the hood.

If you switch from love2d to another engine, it is likely you will need to learn the syntax of that engine's chosen scripting language.
User avatar
pgimeno
Party member
Posts: 3589
Joined: Sun Oct 18, 2015 2:58 pm

Re: Whats Love 2d exactly ?

Post by pgimeno »

To try to clear up other points of confusion that I perceive in Bangester's post:

Lua is an interpreter with many versions. Löve uses version 5.1 specifically, so if you learn, say, Lua 5.3, you won't be able to use these features with Löve. To be more specific, Löve uses LuaJIT, which is compatible with Lua 5.1 only, but it adds its own set of features to the language and you can use those too.

Another difference is that with Lua, you can tell the interpreter which file to run, while with Löve, you have to tell the interpreter which directory (or .love file) to run and that directory must contain main.lua and/or conf.lua.

Other than that, in general you can use Lua normally with love2d as if it was a Lua interpreter, but then you'd need to use love.event.quit() to quit the program because otherwise Löve would keep it running continuously. Everything that starts with love. is what Löve adds to Lua.

That's not how you'd use Löve generally, because then you can't make meaningful programs which do things every frame, but you can use it that way.

So, if you learn Lua 5.1, you can use your knowledge with Löve; you can then learn the Löve-specific features using the wiki, starting here: https://love2d.org/wiki/love
User avatar
notcl4y
Citizen
Posts: 85
Joined: Fri Nov 25, 2022 12:23 pm

Re: Whats Love 2d exactly ?

Post by notcl4y »

Lua is a simple programming language. And Love2D is a game framework, that uses Lua to code.

Code: Select all

loves_lua = "not so",
wants_to = true
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests