Interactive Löve?

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
parallax7d
Citizen
Posts: 82
Joined: Wed Jul 02, 2014 11:44 pm

Interactive Löve?

Post by parallax7d »

Is there a way to load love in the Lua interactive interpreter, and run run, so you can basically play with love in real time? Or something? I love being able to test things rapidly in the Lua command line, was hoping to do something similar with Love?
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Interactive Löve?

Post by Ranguna259 »

You mean changing the main.lua and then the game would reload itself ?
If so the there are a bunch of options you can choose from, one of them is the LoveDebug library.
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Interactive Löve?

Post by slime »

There is also the debug.debug() Lua function, which will pause the game and let you use stdin from your terminal to execute Lua, until you type 'cont'.
User avatar
murks
Party member
Posts: 185
Joined: Tue Jun 03, 2014 4:18 pm

Re: Interactive Löve?

Post by murks »

ZeroBrane Studio has support for this: http://notebook.kulchenko.com/zerobrane ... -with-love
User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Interactive Löve?

Post by Roland_Yonaba »

I remember a similar topic was previously discussed on these forums. Find it here : hot reload. It contains some interesting links and resources.
But The great Murks is right, live coding is probably what you are seeking for.
gestaltist
Prole
Posts: 49
Joined: Thu May 29, 2014 10:56 am

Re: Interactive Löve?

Post by gestaltist »

Not quite what you are asking about but I like Love Fiddle to quickly test stuff:
http://lovefiddle.com
User avatar
dusoft
Party member
Posts: 501
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: Interactive Löve?

Post by dusoft »

parallax7d wrote:Is there a way to load love in the Lua interactive interpreter, and run run, so you can basically play with love in real time? Or something? I love being able to test things rapidly in the Lua command line, was hoping to do something similar with Love?
Simple:
1) Tie reload of the code to some key = e.g. space or enter
2) Put this code into your Love file:

Code: Select all

   package.loaded[state]=false
   require(state)
where state is the file for reload. e.g. if states=main then: require("main")

call that after some keypress, eg. in

Code: Select all

function love.keyreleased(key)
end
first line deletes the meta information from packages table of lua (blanks record), second line reloads the file.
i have used this approach in my state manager (one file = one state):
http://www.ambience.sk/love2d-a-state-s ... class-lua/

this will reload the code on space / enter key press (if there are any other require statements in the main.lua, then you need to re-require them as well)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Interactive Löve?

Post by bartbes »

And there's repler.
You could also start a lua interpreter and load love from it, but that's a more advanced topic..
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], pgimeno and 96 guests