Concat strings using '+' crashes Love on my Mac

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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by kikito »

I confirm that I started getting "silent" errors when I set the debug variable to true.

I reported this error (silent crashes) myself, and bartbes identified and fixed it; I don't remember on what version (anjo's saying that 0.7, but I believe it could have happened before that; I'm not sure anyway)

Maybe you can try posting your code here so everyone can give it a run on their systems.

Also, I suggest changing the thread title to something like "getting silent errors on Mac". Some people just read the title and start typing code, without taking the time to properly understand. Let's make it easier for them.

^^
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by Robin »

kikito wrote:Some people just read the title and start typing code, without taking the time to properly understand.
Subtle. :cool:
Help us help you: attach a .love.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by bmelts »

zac352: I was referring to your explanation of why + was crashing LÖVE with no error screen, which was, as I said, wrong. Yes, your metatable solution works. It's also a horrible hack that there's little to no reason to use.

kikito: the debug bug (well, "bug") was fixed after the 0.6.2 release but before the 0.7.0 beta release, so if the OP is using 0.6.2, that would help explain his issues.
patrickjcollins
Prole
Posts: 6
Joined: Thu Oct 28, 2010 5:31 pm

Re: Concat strings using '+' crashes Love on my Mac

Post by patrickjcollins »

anjo was right, assigning a value to the debug variable is what causes Love to crash. Here is a simple example that crashes Love on my machine :

function love.draw()
debug = "";
love.graphics.print("hi "+"world", 400, 300)
end

I'm new here, so I'm not sure how things work. However, this does seem to be a bug to me. Shouldn't Love be using a namespace (or whatever the Lua equivalent is) for internal variables to avoid collisions?

Patrick
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by nevon »

patrickjcollins wrote:Shouldn't Love be using a namespace (or whatever the Lua equivalent is) for internal variables to avoid collisions?
No, because you should be able to override the debug variable (I think it should be a boolean value, which would explain why it crashed for you) when you ship a game.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by vrld »

The debug variable is actually a Lua module: The Debug Library. It's name is ... unfortunate, but so is "table" and "string"
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by bartbes »

Well it was a bug, 0.7.0 has fixed this.
User avatar
zac352
Party member
Posts: 496
Joined: Sat Aug 28, 2010 8:13 pm
Location: In your head.
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by zac352 »

patrickjcollins wrote:anjo was right, assigning a value to the debug variable is what causes Love to crash. Here is a simple example that crashes Love on my machine :

function love.draw()
debug = "";
love.graphics.print("hi "+"world", 400, 300)
end

I'm new here, so I'm not sure how things work. However, this does seem to be a bug to me. Shouldn't Love be using a namespace (or whatever the Lua equivalent is) for internal variables to avoid collisions?

Patrick
... Debug is a standard library. It's needed for debug.traceback...
Look at the internal scripts. :U

Code: Select all

local function error_printer(msg, layer)
	print((debug.traceback("Error: " .. msg, 1+(layer or 1)):gsub("\n[^\n]+$", "")))
end
That's lines 809-811 of boot.lua. debug="" makes it try to index a string with "traceback", which obviously isn't in string. ;)
Hello, I am not dead.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Concat strings using '+' crashes Love on my Mac

Post by Robin »

That's why several lines up, you can find local debug = debug, which means that you can override debug without any problems. SELÖVE doesn't even expose debug to the game.
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests