Page 1 of 1

Run a love program with no GUI screen [resolved]

Posted: Wed Aug 10, 2016 2:36 pm
by code_fodder
I know the question sounds a bit demented, but I am trying to write a bunch of emulators, some of which need a GUI and some don't.

I could use pure lua, but I really like the love callback mechanism as it provides "scheduler" in its update() callback.

So for the emulators that need the GUI its great, but for the emulators that don't need the GUI I still get the blank window that appears - I kind of just don't want it to appear (or just be hidden).

Is that possible? I have provided my code, but I don't think it makes a difference to this question... here is an example anyway (note no GUI stuff):

Code: Select all

-- TCP Controller
local socket = require("socket")

-- UPDATED AFTER POST:
-- Dont need a GUI
function love.conf(t)
    t.window = nil
end
-- UPDATE END

-- Startup
function love.load()
  udp = socket.udp()
  udp:setsockname("*", 53474)
  udp:settimeout(0)
end

-- Scheduler 
function love.update()
  -- Check for UDP data
  data, ip, port = udp:receivefrom()
  if data then
    print("Received: ", data, ip, port)
    print("Reply...")
    udp:sendto(data, ip, port)
  end
end

Re: Run a love program with no GUI screen

Posted: Wed Aug 10, 2016 2:42 pm
by Nixola
[wiki]love.conf[/wiki]. Just set t.window to nil.

Re: Run a love program with no GUI screen

Posted: Thu Aug 11, 2016 6:09 am
by code_fodder
I added this function in, it did not seem to have an effect - i.e. when I run the command to launch the script:

Code: Select all

c:\test-area\tcp-test> love .
I still have a blank window that appears...

Re: Run a love program with no GUI screen

Posted: Thu Aug 11, 2016 6:19 am
by code_fodder
No, its my mistake, I did not read the instructions carefully. I now created a file called conf.lua and move the function into that - and it now works nicely.

Thanks Nix : )