Page 1 of 1

Interactive Löve?

Posted: Wed Jul 23, 2014 5:07 pm
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?

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 5:28 pm
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.

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 6:56 pm
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'.

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 7:37 pm
by murks
ZeroBrane Studio has support for this: http://notebook.kulchenko.com/zerobrane ... -with-love

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 9:42 pm
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.

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 10:15 pm
by gestaltist
Not quite what you are asking about but I like Love Fiddle to quickly test stuff:
http://lovefiddle.com

Re: Interactive Löve?

Posted: Wed Jul 23, 2014 10:15 pm
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)

Re: Interactive Löve?

Posted: Thu Jul 24, 2014 12:48 pm
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..