Page 1 of 1

Hacking love.run ()

Posted: Thu Apr 21, 2016 10:53 pm
by sirmochi
Hy everyone,

I was thinking about using love for general application development, but would be essential to disable a lot of the things that are useful for games but not for a general application. To start, would be interesting to "hack" the main loop, so would be possible to save some cpu time. But how can I edit it?
At first I want to just call love.draw when needed.

Re: Hacking love.run ()

Posted: Thu Apr 21, 2016 11:03 pm
by Nixola
If you want to make a general application, you're most probably better off with a proper tool for that job (I read about wxlua somewhere, but I've never used it).
That said, the wiki contains the default [wiki]love.run[/wiki]. Just grab that code, edit it as you see fit and put it at the top of main.lua. That will redefine the function.

Re: Hacking love.run ()

Posted: Fri Apr 22, 2016 12:30 am
by zorg
Some other options would be to save it as a separate file, like "gameloop.lua" or whatever, and either assign it to love.run in the body of your main.lua (outside any function), or for and advanced hack, you could even do this in conf.lua (inside the function this time), if you wanted to.
Up- and downsides are left as an excercise to the forumgoer. :3