[Solved] Strange error with field

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
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

[Solved] Strange error with field

Post by alberto_lara »

So I'm creating a small GUI library and I'm running out of ideas on a Lua-level error I'm getting, and this is pretty basic stuff, that's the weirdest thing.

Image

The code is behaving like if I'm setting something like:

Code: Select all

obj.x = 123
and then calling:

Code: Select all

obj['x ']
but I'm never doing such thing, I'm just calling

Code: Select all

obj.x
This is probably a stupid mistake but I'm really stuck... Here's the love file:
gui.love
(2.55 KiB) Downloaded 99 times
Last edited by alberto_lara on Sun Apr 26, 2020 8:05 pm, edited 1 time in total.
NormalKarl
Prole
Posts: 2
Joined: Sun Apr 26, 2020 4:24 pm

Re: Strange error with field

Post by NormalKarl »

Hi there, alberto_lara.

I had this problem when I was developing on mac. Specifically in Xcode. It happens to be something that you can't see but its quite straight forward. It happens to be some hidden characters in the code. Probably doesn't show up because its a non-printable character. If you simple rewrote the line again you will notice there are less characters than the line you already had. If you write the line again and select the line you can see there are 3 more characters on the line you have right now. It happens, you must have just accidentally hit a few keys and inserted some hidden characters.

Code: Select all

self.value = (x - (self.x + self.padding)) * (self.w - self.padding * 2) --3 Extra characters that are hidden
self.value = (x - (self.x + self.padding)) * (self.w - self.padding * 2) --This line works
P.S this may not translate into the forum because it probably culls hidden characters in posts.
User avatar
pgimeno
Party member
Posts: 3637
Joined: Sun Oct 18, 2015 2:58 pm

Re: Strange error with field

Post by pgimeno »

There is an unbreakable space (U+00A0) in 'self.x '. Just delete it and replace with a normal space.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: Strange error with field

Post by alberto_lara »

That did the trick, how could I forget about those characters.. Thanks a lot.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests