[SOLVED] Debugging using ZeroBrane Studio

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.
randomnovice
Party member
Posts: 109
Joined: Sat May 09, 2015 9:15 pm

Re: Debugging using ZeroBrane Studio

Post by randomnovice » Sun Jun 18, 2017 3:58 pm

Thanks,

Probably I'm not supposed to...? But I have. Here's my edited version of love.run() which is calling love.load() near the start?

Code: Select all

function love.run()
	-- Randomness!
	if love.math then love.math.setRandomSeed(os.time()) end
 
	-- Load things in
	love.load()
	  
	-- Big loop for everything
	while true do
		resetvariables()
		music:setLooping(true)
		music:play()

		-- Main game loop until a hero dies
		repeat
			-- Process events
			if love.event then
				love.event.pump()
				for name, a,b,c,d,e,f in love.event.poll() do
					if name == "quit" then
						if not love.quit or not love.quit() then
							return a
						end
					end
					love.handlers[name](a,b,c,d,e,f)
				end
			end
 
			-- Update
			love.update() 

			-- Draw
			love.graphics.clear(love.graphics.getBackgroundColor())
			love.graphics.origin()
			love.draw()
			love.graphics.present()
			
			-- Do I need this?			 
			love.timer.sleep(0.001)

      -- Call the A.I. if the game is not finishing
			if TURN == 2 and finishing == 0 then
				AI()
			end
		until finished == true

		mode = "Title"		-- "Title", "Select Hero", "Select Cards", "Overview"
		mode_old = "Title"	-- Switch back with escape twice
	end
end
(..and the reason for having a custom love.run() function was having this loop at the "base" level)

EDIT: Okay, quite simple in the end then. Just changed love.load() to love.load(arg).
Don't know where arg is defined... but gonna go with what I think works..!

EDIT2: Thanks for the tip Nixola, fairly new to forums so still picking up ettiquete. Would happily delete the below but I think that's not allowed for a normal user.
Last edited by randomnovice on Sun Jun 18, 2017 4:24 pm, edited 2 times in total.

randomnovice
Party member
Posts: 109
Joined: Sat May 09, 2015 9:15 pm

Re: Debugging using ZeroBrane Studio

Post by randomnovice » Sun Jun 18, 2017 4:05 pm

(..and the reason for having a custom love.run() function was having this loop at the "base" level)

randomnovice
Party member
Posts: 109
Joined: Sat May 09, 2015 9:15 pm

Re: Debugging using ZeroBrane Studio

Post by randomnovice » Sun Jun 18, 2017 4:10 pm

Okay, quite simple in the end then. Just changed love.load() to love.load(arg).

Don't know where arg is defined... but gonna go with what I think works..!

User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Debugging using ZeroBrane Studio

Post by Nixola » Sun Jun 18, 2017 4:15 pm

Please, do not triple post like that. You can edit your own posts at any time.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics

User avatar
easy82
Party member
Posts: 184
Joined: Thu Apr 18, 2013 10:46 pm
Location: Hungary

Re: Debugging using ZeroBrane Studio

Post by easy82 » Mon Jun 19, 2017 2:05 pm

Yeah, sorry I should have been more specific. :)

You're right, this is exaclty how I used debugging in ZeroBrane:
zorg wrote:
Sun Jun 18, 2017 3:54 pm
function love.load(arg)
if arg[#arg] == "-debug" then require("mobdebug").start() end
end
I did not have to alter love.run() though, I use the built-in one.
randomnovice wrote:
Sun Jun 18, 2017 4:10 pm
Okay, quite simple in the end then. Just changed love.load() to love.load(arg).

Don't know where arg is defined... but gonna go with what I think works..!
ZeroBrane will execute your program with "-debug" argument when you start debugging.

Post Reply

Who is online

Users browsing this forum: No registered users and 71 guests