Can anyone explain how examples.love works?

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
User avatar
timmeh42
Citizen
Posts: 90
Joined: Wed Mar 07, 2012 7:32 pm
Location: Cape Town, South Africa

Can anyone explain how examples.love works?

Post by timmeh42 »

(Apologies for the hideous title, I have no idea how to explain it concisely)

In the Love wiki tutorials section ([wiki]Category:Tutorials[/wiki]) there is a .love file of a large number of example .loves combined into one (bottom of the list), with a main window giving the user the option to choose different files to load. However, each file seems to be completely separate and independent from the main loader.
How does the main window load each example love and so easily return to the main window? I have looked at the code, but amongst all the functions for displaying the scrollbox in the window, and considering the fact that I am not familiar with the functions used in the first place, I can't see how it works.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Can anyone explain how examples.love works?

Post by Azhukar »

Line 140 of main.lua inside the .love : love.filesystem.load(file)()

It calls the specified file as if it was a function. The examples override keys in the global variable "love", which are afterwards called from the framework and main.lua.
User avatar
timmeh42
Citizen
Posts: 90
Joined: Wed Mar 07, 2012 7:32 pm
Location: Cape Town, South Africa

Re: Can anyone explain how examples.love works?

Post by timmeh42 »

Ah, thank you for that - much easier for me to unravel it all now.
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests