Hacking love.run ()

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
sirmochi
Prole
Posts: 1
Joined: Sat Apr 09, 2016 3:21 pm
Location: BRZ/SP

Hacking love.run ()

Post 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.
:megagrin:
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Hacking love.run ()

Post 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.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Hacking love.run ()

Post 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
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest